pgloader icon indicating copy to clipboard operation
pgloader copied to clipboard

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

Open ashraf-kabir opened this issue 1 year ago • 2 comments

  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:[email protected]:3306/sakila postgresql://ashraf:[email protected]/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

ashraf-kabir avatar Nov 14 '24 14:11 ashraf-kabir

  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:[email protected]:3306/sakila postgresql://ashraf:[email protected]/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:[email protected]:3306/sakila postgresql://ashraf:[email protected]/pagila

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

CIO-COSINE avatar Nov 19 '24 06:11 CIO-COSINE

  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:[email protected]:3306/sakila postgresql://ashraf:[email protected]/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:[email protected]:3306/sakila postgresql://ashraf:[email protected]/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.

ashraf-kabir avatar Nov 20 '24 08:11 ashraf-kabir