The client cannot resolve the hostname in the connection string, so the MySQL server remains unreachable.
MySQL Error 2005: CR_UNKNOWN_HOST means the hostname in your connection string cannot be resolved. Verify DNS, hosts file, or use the correct IP address to connect successfully.
Unknown MySQL server host '%s' (%d)
MySQL raises Error 2005 (CR_UNKNOWN_HOST) when the client library cannot translate the host string you passed to a valid IP address. The TCP connection never starts, so authentication and SQL execution do not occur.
The message includes the failing host value and a system errno.
These details point to DNS or networking layers, not the MySQL daemon itself.
It appears immediately after a mysql, mysqldump, JDBC, or Python connector call that contains a typo, stale DNS entry, or blocked outbound port 3306.
Cloud VMs with custom DNS or VPNs often surface the issue.
Local development can also trigger the error if /etc/hosts or Windows hosts entries are missing for aliases like mysql.local.
Start by pinging the hostname from the same machine. If ping fails, check DNS or the hosts file. If ping succeeds, verify your MySQL port and firewall.
Finally, replace the hostname with a verified IP address to isolate name-resolution problems.
Updating connection strings in ORM configs, Docker compose files, or Kubernetes Secrets prevents the error across deployments.
In Docker, the service name must match the container’s network alias.
Using “localhost” inside one container fails; use the service alias instead.
For AWS RDS, ensure the VPC DNS resolver is enabled and that your security group allows outbound DNS requests (port 53) and MySQL (3306).
Store hostnames in environment variables managed by your CI/CD. Validate them during health checks.
Monitor DNS latency and failures with tools like dig or nslookup inside your application container.
With Galaxy, test queries directly in the editor; failed connections surface instantly, letting you correct host settings before committing code.
.
It is a client-side networking error; the MySQL server never receives the connection request.
Yes. Use the server’s IP address directly or add a hosts file entry. This instantly proves whether DNS is the culprit.
No. Error 2005 is generated by the libmysql client, so it appears across all server versions when name resolution fails.
Galaxy shows connection failures inline and lets you test alternate hosts quickly, reducing debugging time.