Mysql报错Forcing close of thread 139 user: ‘root’

最近重启服务器的mysql总是报大量的如下错误:

160330  9:14:26 [Warning] /usr/libexec/mysqld: Forcing close of thread 139  user: ‘root‘
160330  9:14:26 [Warning] /usr/libexec/mysqld: Forcing close of thread 138  user: ‘root‘
160330  9:14:26 [Warning] /usr/libexec/mysqld: Forcing close of thread 137  user: ‘root‘
160330  9:14:26 [Warning] /usr/libexec/mysqld: Forcing close of thread 136  user: ‘pdss‘
160330  9:14:26 [Warning] /usr/libexec/mysqld: Forcing close of thread 131  user: ‘root‘
160330  9:14:26 [Warning] /usr/libexec/mysqld: Forcing close of thread 130  user: ‘csm‘

这个错误其实是mysql在对DNS做反查,由于反查的接续速度过慢,大量的查询处理不及时,线程得不到释放,造成MySQL“ 假死”。

解决办法

linux服务器
修改mysql的配置文件(my.cnf)在[mysqld]下添加:
skip-name-resolve
windows服务器
修改mysql的配置文件(my.ini)在[mysqld]下添加:
skip-locking
skip-name-resolve

修改完成后,重启mysql服务。