Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
ashraf-kabir opened this issue Nov 14, 2024 · 2 comments
Open

Comments

@ashraf-kabir
Copy link

  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
@CIO-COSINE
Copy link

  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

@ashraf-kabir
Copy link
Author

  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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants