Skip to content

Connect to MySQL in Docker from Mac

Connect to the port Docker publishes on your Mac, rather than the container’s internal address.

You need a running MySQL container with a published TCP port and an existing database account. This guide assumes Docker runs on your Mac.

List the running containers:

Terminal window
docker ps

Read the MySQL container’s port mapping. For 127.0.0.1:3307->3306/tcp, TableAI connects to 127.0.0.1:3307. Port 3306 belongs to MySQL inside the container.

Read the database and account names from your container setup. The account in an existing database volume can retain its original password after environment variables change.

  1. Open the connection form and select MySQL as Driver.
  2. Set Host to 127.0.0.1.
  3. Set Port to the published host port, such as 3307.
  4. Enter the container’s Database, User, and Password.
  5. Configure TLS as described below.
  6. Click Test, then Save & Connect when it succeeds.

For a trusted loopback container without TLS, select SSL Mode › Disable. For a TLS-enabled server, follow SSL/TLS settings.

For Docker on another machine, use that machine’s reachable address and published port. An SSH tunnel can provide access to a private Docker host.

connection refused
Access denied for user

If the container is absent from docker ps, check why it stopped. If it is running, compare the published port with Port in TableAI. A container without a host port mapping is not reachable through 127.0.0.1 on your Mac.

Use error 2002 to test TCP access and error 1045 for credentials. A localhost port does not require macOS Local Network permission; other network checks are in connection troubleshooting.

Continue with browse and search, or return to the MySQL overview.