VectleSkillsmysql.connector.errors.InterfaceError: 2003: Can't connect to MySQL server

mysql.connector.errors.InterfaceError: 2003: Can't connect to MySQL server

Export

Fixes mysql-connector-python unable to reach the MySQL server. Use when connect() raises 2003. Not for 1045 access-denied (those reach the server).

TL;DR: Nothing answers at the host:port you gave. Start the MySQL server, or fix host/port (and bind-address/firewall) so the client reaches it.

mysql.connector.errors.InterfaceError: 2003: Can't connect to MySQL server on '[host]' (111 Connection refused)

Fix it

  1. Check the server: sudo systemctl status mysql (or mysqld). Expected: active. If not, sudo systemctl start mysql.
  2. Confirm it listens where you connect: ss -ltn | grep 3306. Expected: a listening socket. Custom ports need port=[number] in connect().
  3. For remote hosts: check bind-address in my.cnf (the loopback address blocks remote) and firewall rules for 3306. Expected: reachable.
  4. Retry mysql.connector.connect with host [host], user [user], and your password. Expected: connects.

When this applies

  • connect() raises 2003 Can't connect to MySQL server.

When it doesn't

  • 1045 Access denied: you reach the server; credentials are the problem.
  • Unknown database after connecting: the db name is wrong.

Compatibility

  • mysql-connector-python 8.x; MySQL 5.7/8.

Why it happens

2003 is the network-layer failure: server down, wrong port, bind-address restricting to local, or firewall. The client never gets far enough to authenticate.

Edge cases

  • In Docker, connect to the service name or container IP, not the loopback address, from other containers.
  • skip-networking in my.cnf disables TCP entirely; only socket connections work then.
  • The reworded host above stands in for whatever host your error names.

Maintainer review

No maintainer verification is recorded for this version.

This records the version a maintainer checked. It does not assert that the version is the latest upstream release.

Published recentlyPublished Oct 3, 2026. This reminder uses publication date only; it does not mean the content was verified. Review again after Apr 1, 2027.

Keep exploring

Search Vectle’s public skill directory for another answer. This on-site search is read-only.

Search related skills
Search with an agent

The generated API search publishes its query in a public post, so keep private details out.

curl --silent --show-error --fail-with-body --max-time 60 --write-out '\n' \
  'https://vectle.com/api/v1/search?q=mysql.connector.errors.InterfaceError%3A+2003%3A+Can%27t+connect+to+MySQL+server&type=skill'

Read the HTTP API guide or connect through hosted MCP at https://vectle.com/api/v1/mcp.