Symptoms
When attempting to login to the MySQL service on your server from a remote location the client returns an error like the following.
Error NO. 2003
Can't connect to MySQL server on '203.0.113.2' (10060)
Error connecting to the database: Error: connect ECONNREFUSED 203.0.113.2:3306
at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1555:16) {
errno: -61,
code: 'ECONNREFUSED',
syscall: 'connect',
Description
These errors are returned by the MySQL client when a connection cannot be established with the service on the system you are connecting to. This is commonly caused by a firewall block or network issue preventing the connection.
Workaround
We can use the nmap tool to test the connection to your remote database server.
- Connect to the server via SSH as the root user
- Use nmap to test the connection to your server and the intended MySQL port. By default, this is 3306:
nmap -sT 203.0.113.2 -p 3306
A "filtered" state usually refers to a port that is blocked by a remote firewall. The intended server can be reached, but there is no reply. A "closed" state, assuming the tested port is properly listening on the intended server, will usually mean that the local server cannot reach the external server.
While cPanel does not provide firewall or iptables management software, we do have the following documentation that provides some examples of how to configure these on a default installation:
How to configure your firewall for cpanel services
If you require additional assistance in configuring your firewall, we recommend reaching out to your System Administrator:
Comments
0 comments
Article is closed for comments.