Summary of remote connection to the MySQL database
When I remotely connect to the MySQL database, I have encountered some miscellaneous problems. I believe many people have encountered such problems. The following is a summary of these problems, so that they can be searched directly in the future.
1: ERROR 2003 (HY000): Can't connect to MySQL server on 'xxx. xxx. xxx. XXX' (111)
[root@cluster-00 ~]# mysql -h 10.20.34.76 -u root -p
Enter password:
ERROR 2003 (HY000): Can't connect to MySQL server on '10.20.34.76' (111)
[root@cluster-00 ~]# perror 111
OS error code 111: Connection refused
[root@cluster-00 ~]#
Cause 1: The server 10.20.34.76 cannot be accessed or pinged. This is a good verification.
Cause 2: the MySQL service is not started. This verification is also very convenient.
Cause 3: MySQL has configured the skip-networking parameter. You can simply cancel this parameter.
2: ERROR 2003 (HY000): Can't connect to MySQL server on 'xxx. xxx. xxx. XXX' (113)
[root@cluster-00 ~]# mysql -h 10.20.34.76 -uroot -p
Enter password:
ERROR 2003 (HY000): Can't connect to MySQL server on '10.20.34.76' (113)
[root@cluster-00 ~]# perror 113
OS error code 113: No route to host
After the firewall is disabled (not recommended) or the relevant port is opened (3306 by default), the problem can be solved.
3: ERROR 1045 (28000): Access denied for user 'root' @ 'xxx. xxx. xxx. XXX' (using password: YES)
[root@cluster-00 ~]# mysql -h 10.20.34.76 -uroot -p
Enter password:
ERROR 1045 (28000): Access denied for user 'root'@'192.168.9.224' (using password: YES)
[root@cluster-00 ~]#
Cause: the root account has insufficient permissions. It may only be used locally and cannot be remotely logged on. You need to set account permissions. Note: This is just a test diagram. Normally, root's remote access permission should not be enabled. Generally, remote access should be disabled for security reasons.
These are my summary of some problems. If you encounter other problems in the future, I will continue to add them to this blog.