Troubleshoot MySQL® Profiles
Last modified: May 26, 2020
This document describes additional steps to follow if you experience problems when you attempt to connect to your remote MySQL® server.
If you see a Can’t connect to local MySQL server through socket ‘/var/lib/mysql/mysql.sock’ (2) 0 error, verify whether the
mysqld daemon is functional.
- If the daemon is functional, verify the Unix socket. To do this, run the
netstat -ax | grep mysqlcommand.
- If you have one socket and an application points to the other socket, make a symbolic link to point it to the correct socket.
The following describes some errors that you may encounter, their possible causes, and the solutions we recommend:
Failed to connect to remote server
DNS error: the server cannot resolve the hostname
Verify your DNS configuration settings.
Invalid IP address error: the IP address does not exist
- Confirm the local server’s IP address network configuration. For more information, read our Installation Guide - Troubleshoot Your Installation.
- Confirm the remote MySQL server’s IP address.
- Ensure that the remote MySQL server is responsive.
- Verify the local and remote server firewall configuration settings.
Incorrect SSH port
- Confirm the SSH port on the remote MySQL server:
1 2 3
# ss -pln | grep ssh LISTEN 0 128 :::22 :::* users:(("sshd",1163,4)) LISTEN 0 128 *:22 *:* users:(("sshd",1163,3))
- Enter the correct SSH port for the remote MySQL server. In the example, the correct port is 22.
Invalid SSH credentials
Verify you have the correct username and password to access the remote MySQL server.
Unable to connect to remote MySQL host IP, connection failed with error
Host ‘hostname’ is not allowed to connect to this MySQL server
Insufficient MySQL permissions
Grant the user superuser access.
Lost connection to MySQL server at ‘handshake: waiting for initial communication packet’, system error: 110
Firewall error. The server cannot access the specified port on the remote MySQL server.
Verify your firewall configuration settings. For more information, read our How to Configure Your Firewall for cPanel & WHM Services documentation.
Cannot connect to MySQL server on ‘IP’ (107)
MySQL is down on the remote MySQL server.
Restart MySQL on the remote MySQL server.
Incorrect MySQL port.
- Confirm the MySQL port on the remote MySQL server:
# ss -pln | grep mysql LISTEN 0 50 *:3306 *:* users:(("mysqld",3308,12))
- Enter the correct MySQL port for the MySQL server. In the example, the correct port is 3306.
Reverse DNS entry warning
Before you set up a remote MySQL server, ensure that the remote server can resolve your local server’s hostname to its IP address. To confirm this, log in to the remote server via SSH and run the following command, where
22.214.171.124 represents the IP address:
If you do not have a reverse DNS entry configured for your hostname, add an entry for your hostname to the
/etc/hosts file on the remote server.
For more information, read our How to Configure Reverse DNS for BIND in WHM documentation.
You can change the MySQL
root password in WHM’s MySQL Root Password interface (WHM >> Home >> SQL Services >> MySQL Root Password). If you use a remote MySQL server, you must choose whether you will change the local or the remote server’s
root password. By default, the system selects the remote MySQL server.
If you install MySQL 8.0 on a remote server from the community repository, the server will enable its own levels of password validation by default. These may conflict with cPanel & WHM’s password validation.
- If you use the Automatically create a MySQL superuser via SSH. option to set up the remote MySQL profile, the system will automatically make an adjustment for these different validation schemes.
- If you use the Manually enter an existing MySQL superuser’s credentials option to set up the remote MySQL profile, you will need to perform the following changes through the MySQL command line:
- Open the
/etc/my.cnffile with your preferred text editor.
- Add the following lines to the file:
validate-password.policy=0 validate-password.length=1 validate_password.special_char_count=0 validate_password.mixed_case_count=0 validate_password.number_count=0
- Open the
MySQL 8.0 running on a cPanel server
When the remote MySQL server is also a cPanel & WHM server, you must perform additional steps:
- If you change the MySQL
rootpassword on the hosting server, you must update the remote MySQL server’s
- If you change the MySQL
rootpassword on the remote MySQL server, you must update the MySQL profile on the hosting server, and then reactivate the profile.
MySQL 8.0 running on any other server
When the remote MySQL server is running on any other server, you must turn off password caching. Perform the following steps to avoid an authentication error:
- Open the
/etc/my.cnfwith your preferred text editor.
- Change the
default-authentication-pluginsettings value to
mysql_native_password. This will resemble the following example:
- Log in to MySQL at the command line. Then, run the following command:
mysql> ALTER USER 'root'@'cpanel.server.host' IDENTIFIED WITH mysql_native_password BY '12345luggage';Important:
Use a secure password. A secure password is not a dictionary word, and it contains uppercase and lowercase letters, numbers, and symbols.