同事报后台登陆不上了,报错不能连接到数据库.马上到数据库一看连接数已经到达1000了,已经把连接数占满了.

为了不影响其他应用,先把连接数加大再说.

set global max_connections=2000;

再往下查,发现都是这样的连接.

| 16472659 | unauthenticated user | 192.168.100.11:55282       | NULL  | Connect     |   NULL | login                                                          | NULL             |
| 16472660 | unauthenticated user | 192.168.100.11:55284       | NULL  | Connect     |   NULL | login                                                          | NULL             |
| 16472661 | unauthenticated user | 192.168.100.11:55290       | NULL  | Connect     |   NULL | login                                                          | NULL          

 

google出原来是:

看下手册中的解释是:unauthenticated user refers to a thread that has become associated with a client connection but for which authentication of the client user has not yet been done。意即:有一个线程在处理客户端的连接,但是该客户端还没通过用户验证。
原因可能有:
1、        服务器在做DNS反响解析,解决办法有2:
1、) 在 hosts 中添加客户端ip,如
192.168.0.1  yejr
2、) MySQL启动参数增加一个skip-name-resolve,即不启用DNS反响解析
2、服务器的线程还处于排队状态,因此可以加大 back_log

我的授权表是用的IP地址和域名都有.不能重启mysql服务,只能增加hosts记录 192.168.100.11    webserver

仍然连接错误,这次报的是webserver无法连接到192.168.100.11 ,没办法了只能给用户重新加下授权表主机名为webserver.

grant all privileges on *.* to 'user'@'webserver' identified by 'passwd';

flush privileges;

flush hosts;