techouse / sqlite3-to-mysql

Transfer data from SQLite to MySQL

Home Page:https://techouse.github.io/sqlite3-to-mysql/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Tried migration using Docker container but didn't work

surapuramakhil opened this issue · comments

Describe the bug
find output

Unable to find image 'ghcr.io/techouse/sqlite3-to-mysql:latest' locally
latest: Pulling from techouse/sqlite3-to-mysql
661ff4d9561e: Already exists
44cda88cd45d: Pull complete
8d184ace8e99: Pull complete
fbcb6e47dc5d: Pull complete
8dc42379c8ec: Pull complete
f5da05dee4b9: Pull complete
Digest: sha256:dd9c087f4231979f2392a5b83242ef57c1075bb00dcdd18be5c1253bad113967
Status: Downloaded newer image for ghcr.io/techouse/sqlite3-to-mysql:latest
2024-02-15 13:23:28 ERROR    2003: Can't connect to MySQL server on '%-.100s:%u' (%s) (Warning: %u format: a real number is required, not str)
2003: Can't connect to MySQL server on '%-.100s:%u' (%s) (Warning: %u format: a real number is required, not str)

that's end output.

Expected behaviour
What you expected.

Actual result
What happened instead.

System Information

$ sqlite3mysql --version
<paste here>

This command is only available on v1.3.6 and greater. Otherwise, please provide some basic information about your system (Python version, operating system, etc.).

Additional context
Add any other context about the problem here.

In case of errors please run the same command with --debug. This option is only available on v1.4.12 or greater.

Hey,

How did you mount/expose your database to the docker image?

Have you followed the instructions here https://github.com/techouse/sqlite3-to-mysql?tab=readme-ov-file#docker ?

Mysql is running on host machine, i have exposed it using --mysql-host host.docker.internal as mentioned in your docs. Here is the docker command i have used

I am running it in the location where my sqlite db file is present.

docker run -it \
    --workdir $(pwd) \
    --volume $(pwd):$(pwd) \
    --rm ghcr.io/techouse/sqlite3-to-mysql:latest \
    --sqlite-file <my sqlite file> \
    --mysql-user <mysql_username>\
    --mysql-password <mysql pwd> \
    --mysql-database <db name> \
    --mysql-host host.docker.internal

Hmm, looks like this is a known issue and has to do with the fact that the hostname has the port in it. Could you try passing the port separately?

I am running mysql on its default port 3306. can you share instructions or parameter that I can use for passing port to the image

Try using this switch
-P, --mysql-port INTEGER MySQL port. Defaults to 3306.

Also, what's the host OS you're running this on? I've only ever tested this Docker command on macOS.

Hey @techouse , I have tried adding port. its still the same

docker run -it \
    --workdir $(pwd) \
    --volume $(pwd):$(pwd) \
    --rm ghcr.io/techouse/sqlite3-to-mysql:latest \
    --sqlite-file ***** \
    --mysql-user ****** \
    --mysql-password ***** \
    --mysql-database ***** \
    --mysql-host host.docker.internal \
    --mysql-port 3306
2024-02-19 22:26:52 ERROR    2003: Can't connect to MySQL server on '%-.100s:%u' (%s) (Warning: %u format: a real number is required, not str)
2003: Can't connect to MySQL server on '%-.100s:%u' (%s) (Warning: %u format: a real number is required, not str)

Even I tried with -P its still same

 docker run -it     --workdir $(pwd)     --volume $(pwd):$(pwd)     --rm ghcr.io/techouse/sqlite3-to-mysql:latest     --sqlite-file ****     --mysql-user ******     --mysql-password ******     --mysql-database ******     --mysql-host host.docker.internal     -P 3306
2024-02-19 22:27:34 ERROR    2003: Can't connect to MySQL server on '%-.100s:%u' (%s) (Warning: %u format: a real number is required, not str)
2003: Can't connect to MySQL server on '%-.100s:%u' (%s) (Warning: %u format: a real number is required, not str)

python tool worked. I have did migration using python. but docker version didn't work

Hey @surapuramakhil

I just tried it on macOS 14.3.1 running Docker v25.0.3 and MySQL v8.2.0 running locally on port 3306 and it worked just fine porting this example database using the exact command as in the readme

docker run -it \
    --workdir $(pwd) \
    --volume $(pwd):$(pwd) \
    --rm ghcr.io/techouse/sqlite3-to-mysql:latest \
    --sqlite-file sakila.db \
    --mysql-user foo \
    --mysql-password bar \
    --mysql-database sakila \
    --mysql-host host.docker.internal

but docker version didn't work

So I gather your Docker setup is misconfigured?

I am running it on Linux - Ubuntu 22. Even I have close docker version - 25.0.1

you can also check the commands i have ran along with its output.

Let me know if you need any additional information for debugging

Hey,

I simply can'r reproduce it with any demo SQLite db.

Could you maybe send me a snippet of your SQLite database? Maybe it holds some clues.

Yeah Sure. its an open source project. Apache Answer https://github.com/apache/incubator-answer

I have initially started with project using sqlite. Now migrating it to mysql

I'm sorry, maybe I wasn't clear enough. I need a sample of your database that is problematic, otherwise I can not help you.