Lost connection to MySQL server at & #039; reading authorization packet & #039; Solution

Source: Internet
Author: User

Lost connection to MySQL server at 'reading authorization packet 'Solution

Mysql Version: 5.1.73

OS Version: Centos 5.9

Problem description:

Today, an error is reported when a php program connects to Mysql from a client. The information is as follows:

Lost connection to MySQL server at 'reading authorization packet'When you see this error message, the first thought is whether the client cannot be connected and the server can be connected locally. After verification, the server can be connected locally, which is relieved. On the one hand, many tasks run on the Mysql server. If the connection fails locally, most programs will be blocked;

On the other hand, if the server can connect, you can check the problem.

UseShow processlistWhen you view the connection, you find that there are not many connections, and the concurrency is not high. It is not a concurrency problem, but there is a value that is conspicuous:

Unauthenticated user, Similar to the error message, unverified users.

I checked the relevant information and explained it as:"Unauthenticated user"Is a connection initiated by a client, but this client user has not been authenticated. This problem occurs when the system load is high or mysql is busy.

If you see that the connection is not high, it may be caused by a high load. Then, you can check the server load. The load is not high .....

There is also a parameter to mention, that isSkip-name-resolve. When the client is connected, the server checks the DNS of the client to obtain the domain name or host name of the client. WhileSkip-name-resolveThis parameter indicates that reverse domain name resolution is prohibited. Then I doubt whether a problem occurs on the DNS server, which leads to a problem with the connection verification user.

Then I checked the skip-name-resolve status.

The skip-name-resolve parameter has been set. This problem can be ignored in the past.

Then, the OS-level monitoring network card with a traffic alarm is detected. Then I found a problem. The PHP program's access to Mysql (hundreds of select requests per second) is based on the Internet, resulting in high traffic. Then I looked at the Intranet Nic, Gigabit network card, and decided to move the Internet-based access to the Intranet... After observing for a while, the connection is mitigated, and the problem does not occur .....

! Record the Mysql connection exception caused by the NIC!

 

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.