MySQL error 2003: Can't connect to MySQL server on host
The client couldn't open a TCP connection to the host and port. The server is down, listens elsewhere, or a firewall is in the way.
- Error number
2003- Name
CR_CONN_HOST_ERROR- Category
- Connection and client
What it means
2003 is raised by the client when the TCP connection itself fails. The number in brackets is the operating-system error: (111) or (10061) on Windows means connection refused (nothing listening), (110) or (10060) means timed out (usually a firewall dropping packets), and (113) means no route to host.
The server never saw the login, so the password and grants don't matter yet.
Common causes
- The server isn't running, or listens on another port than 3306.
- The server only listens on
127.0.0.1(bind_address), so remote connections are refused. - A firewall, security group or cloud network rule blocks port 3306.
- Wrong host name or IP address in the connection settings.
How to fix it
-
On the server, check that MySQL is running and which address and port it listens on.
SHOW VARIABLES WHERE Variable_name IN ('bind_address', 'port', 'skip_networking'); -
To accept remote connections, set
bind_address = 0.0.0.0(or the server's own IP) in the[mysqld]section of the configuration file and restart MySQL. Make sure an account exists for the remote host. -
Open the port in the server's firewall and any cloud security group, then test from the client machine, for example with
nc -vz db.example.com 3306.
Related errors
2002Can't connect through socket2005Unknown MySQL server host1130Host is not allowed to connect2013Lost connection to MySQL server during query53SQL Server: Network-related or instance-specific08006PostgreSQL: connection failureORA-12541Oracle: TNS: no listener
More connection and client errors
2006MySQL server has gone away2055Lost connection to MySQL server at stage2026SSL connection error2059Authentication plugin cannot be loaded2061Authentication plugin reported error1251Client doesn't support auth protocol3159Insecure transport prohibited1158Error reading communication packets
The code and message text are from the MySQL 8.4 Error Message Reference. Browse the full MySQL error list or search every database error.
Work on MySQL in SQLly
A native SQL client for macOS, Windows and Linux with schema-aware IntelliSense, guardrails for risky statements and clear error messages, for MySQL and the other databases you use.