dimitri / pgloader

Migrate to PostgreSQL in a single command!
http://pgloader.io
Other
5.45k stars 548 forks source link

ERROR mysql: Failed to connect to mysql at "localhost" (port 3306) #1624

Open ashraf-kabir opened 1 week ago

ashraf-kabir commented 1 week ago
  1. pgloader version: pgloader version "3.6.10~devel" compiled with SBCL 2.2.9.debian
  2. Command: docker run --rm -it ghcr.io/dimitri/pgloader:latest pgloader mysql://ashraf:ashraf@127.0.0.1:3306/sakila postgresql://ashraf:ashraf@172.17.0.2/pagila
  3. Error: ERROR mysql: Failed to connect to mysql at "localhost" (port 3306) as user "ashraf": Condition USOCKET:CONNECTION-REFUSED-ERROR was signalled.
  4. Screenshot: image
CIO-COSINE commented 2 days ago
  1. pgloader version: pgloader version "3.6.10~devel" compiled with SBCL 2.2.9.debian
  2. Command: docker run --rm -it ghcr.io/dimitri/pgloader:latest pgloader mysql://ashraf:ashraf@127.0.0.1:3306/sakila postgresql://ashraf:ashraf@172.17.0.2/pagila
  3. Error: ERROR mysql: Failed to connect to mysql at "localhost" (port 3306) as user "ashraf": Condition USOCKET:CONNECTION-REFUSED-ERROR was signalled.
  4. Screenshot: image

In your docker command, try replacing "localhost/127.0.0.1" with "host.docker.internal". So it will instead become:

docker run --rm -it ghcr.io/dimitri/pgloader:latest pgloader mysql://ashraf:ashraf@host.docker.internal:3306/sakila postgresql://ashraf:ashraf@172.17.0.2/pagila

Reference: https://docs.docker.com/desktop/features/networking/#i-want-to-connect-from-a-container-to-a-service-on-the-host

ashraf-kabir commented 1 day ago
  1. pgloader version: pgloader version "3.6.10~devel" compiled with SBCL 2.2.9.debian
  2. Command: docker run --rm -it ghcr.io/dimitri/pgloader:latest pgloader mysql://ashraf:ashraf@127.0.0.1:3306/sakila postgresql://ashraf:ashraf@172.17.0.2/pagila
  3. Error: ERROR mysql: Failed to connect to mysql at "localhost" (port 3306) as user "ashraf": Condition USOCKET:CONNECTION-REFUSED-ERROR was signalled.
  4. Screenshot: image

In your docker command, try replacing "localhost/127.0.0.1" with "host.docker.internal". So it will instead become:

docker run --rm -it ghcr.io/dimitri/pgloader:latest pgloader mysql://ashraf:ashraf@host.docker.internal:3306/sakila postgresql://ashraf:ashraf@172.17.0.2/pagila

Reference: https://docs.docker.com/desktop/features/networking/#i-want-to-connect-from-a-container-to-a-service-on-the-host

I got the same error.