Summary of remote connection to the MySQL database

Source: Internet
Author: User

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.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.