mysql 多种小错解决

来源:互联网 发布:mysql to date函数 编辑:程序博客网 时间:2024/04/26 12:27

1.。。。。。。。。。。。。。。。。。

当你的web服务器和mysql服务器分离的情况下,web服务器连不上mysql服务器,show processlist mysql服务器出现以下:

| 364 | unauthenticated user | xxx.xxx.xxx.xxx:63249 | NULL | Connect |      | login | NULL             |
| 365 | unauthenticated user | xxx.xxx.xxx.xxx:56768 | NULL | Connect |      | login | NULL             |
| 366 | unauthenticated user | xxx.xxx.xxx.xxx:54127 | NULL | Connect |      | login | NULL             |
| 367 | unauthenticated user | xxx.xxx.xxx.xxx:51060 | NULL | Connect |      | login | NULL             |


解决方法:

看下手册中的解释是: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


在数据库服务器上/etc/hosts添加web服务器的ip地址即可


[root@bogon etc]# cat /etc/hosts;
127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4
::1         localhost localhost.localdomain localhost6 localhost6.localdomain6
124.172.223.XX

最后重启mysqld服务器。