Mysql unauthenticated user connect

Source: Internet
Author: User
Tags php server

Today, the user access to the voting system of the newly deployed project is very slow. The voting system is based on the PHP environment and uses short connections to access the mysql database. The CPU load of the monitored database PHP server is high, MYSQL database load is normal
Mysql> show full processlist;
Found a large number of unauthenticated user connection information
13012 unauthenticated user x. x: 2501 None Connect Reading from net
10056 unauthenticated user x. x: 2805 None Connect Reading from net
10311 unauthenticated user x. x: 2306 None Connect writing to net
10326 unauthenticated user x. x: 2715 None Connect login
10422 unauthenticated user x. x: 2811 None Connect login
The solution is as follows:
1. in/etc/my. cnf, add the skip-name-resolve parameter to disable the dns anti-query of mysql. mysql uses IP authorization.
2. Add the ing between the IP address and the host name in/etc/hosts and check the/etc/resovle primary DNS service.
3. Adjust the mysql max_connections, max_allowed_packet, wait_timeout, and interactive_timeout parameters.
 
It has been confirmed that most of the above parameter production environments have been configured. When a large number of unauthenticated user information is displayed, it indicates that mysql did not send a confirmation credential to these client connection requests, that is to say, mysql cannot confirm the database account information used for these connections. Within wait_timeout, mysql waits until these connections are complete and tests telnet x. x. x. x 3306, an unauthenticated user x will also appear in the mysql database. x. x. x: 4706 None Connect Reading from net connection, so this phenomenon is not necessarily a database problem, which may occur below
1. If a large number of database probes occur due to application security issues, there will be a large number of such unauthorized connections.
2. Application Service pressure is too high, and thread exception interruption causes a large number of abnormal database connections
3. Application Service exceptions, resulting in a large number of abnormal database connections
4. the MySQL client connection version is incorrect. The authentication protocol is incompatible. Pay special attention to the old-password authentication method.
Finally, the voting system adds a verification code to prevent ticket flushing and reduce the possibility of illegal and abnormal connections. After the PHP service is restarted, the CPU load returns to normal, and the mysql database unauthenticated user connection does not occur again.


This article is from the "IT milk" blog

Related Article

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.