MySQL Remote link problem

Source: Internet
Author: User

Problem Description:

From a Linux remote connection on another Linux MySQL, error 2003 (HY000): Can ' t connect to MySQL server on ' xxx.xxx.xxx.85 ' (111) errors. [[Email protected]vcs0 ~]$ mysql-hxxx.xxx.xxx.85-uroot-penter password:www.2cto.com ERROR 2003 (HY000): Can ' t Connec T to MySQL server on ' xxx.xxx.xxx.85 ' (111) [[email protected] ~]$ perror 111OS error code 111:connection refused view Errorco de [[Email protected] ~]$ perror 111 OS error code 111:connection refused
Problem Analysis: 1, may network connection ask, remote ping xxx.xxx.xxx.85, can ping pass, exclude this condition [[email protected] ~]$ ping xxx.xxx.xxx.85 Ping xxx.xxx.xxx.85 ( xxx.xxx.xxx.85) bytes of data.64 bytes from xxx.xxx.xxx.85:icmp_seq=1 ttl=63 time=0.230 Ms 2, troubleshooting may be due to 85 on the my.cnf configured with SK Ip_networking or bind_address, allow only local socket connections 2.1 set skip_networking under [mysqld], knowledge Description: This uses MySQL only through the native socket connection ( Socket connection is also the default way of local connection), discard the TCP/IP monitoring www.2cto.com Of course also do not let the local Java program connection to MySQL (connector/j only through TCP/IP to connect). 2.2 may have used bind_address=127.0.0.1 (or other IP, of course) [mysqld] bind_address=127.0.0.1 Knowledge Description: This situation can be tcp/ IP connection by viewing the my.cnf file, the above two are not set, excluding the two cases
3, troubleshoot the DNS resolution problem, check whether it is set: Skip_name_resolve. This situation is certainly not possible, because I use IP, not hostname. [Mysqld]skip_name_resolve Knowledge Description: This parameter plus, does not support the host name connection mode.
4, troubleshoot the user and password problems, in fact, the user and password error, will not appear 111, so troubleshoot the user password Error 1045 (28000): Access denied for user ' root ' @ ' XXXX ' (using Password:yes)
5, troubleshoot the--port problem, it is possible that 85 of MySQL port is not the default 3306, so I connect remotely, did not specify--port, with 3306, and 85 did not listen to 3306. Ps-ef | grep mysqld sure is: MySQL on 85 uses 3308 port. Final connection: plus--port=3308 [[email protected] ~]$ mysql-hxxx.xxx.xxx.85-uroot-p--por t=3308 Enter Password:welcome to the MySQL Monitor. Commands End With; or \g.
Why is there such a low-level mistake? Because I have been using the 85 MySQL, and each time is directly connected with Mysql-uroot, no designated--port, so I always thought this MySQL port has been the default of 3306.
In fact, the root cause is:
1. mysql local connection, if not referred to as MySQL--protocol=tcp, the connection by default is the socket connection.  We all know this. Www.2cto.com 2, MySQL socket connection is based on the Sokect file, not related to--port, if it is a multi-instance, then use-s (or--socket=name) to specify which instance to connect. This is the socket connection to--port No recognition effect, resulting in troubleshooting this problem for so long. See below: In fact, there is only one port of 85 on the MySQL instance, but with 3306 is still connected on this instance, indicating that the socket connection method ignores the--port parameter. -bash-3.2$ Mysql-uroot--port=3308 Welcome to the MySQL monitor. Commands End With;  or \g. Mysql-uroot--port=3306 Welcome to the MySQL Monitor. Commands End With; or \g. It's important to explain the basics again.

MySQL Remote link problem

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.