MySQL could not be resolved: Temporary failure in name resolution報錯解決方法

chenfeng發表於2017-05-06
最近幾天研發總是抱怨用Navicat連線MySQL資料庫和開啟資料表很慢,登入資料庫分析,檢視錯誤日誌:


mysql> show variables like 'log_error';
+---------------+--------------------------------+
| Variable_name | Value                          |
+---------------+--------------------------------+
| log_error     | /usr/local/mysql/data/idb3.err |
+---------------+--------------------------------+
1 row in set (0.00 sec)


檢視錯誤日誌:

[root@idb3 data]# cat /usr/local/mysql/data/idb3.err | grep failure |more
2016-05-24 16:06:44 11382 [Warning] IP address '172.31.19.113' could not be resolved: Temporary failure in name resolution
2016-05-24 16:06:47 11382 [Warning] IP address '172.31.19.113' could not be resolved: Temporary failure in name resolution
2016-05-24 16:09:00 11382 [Warning] IP address '172.31.19.113' could not be resolved: Temporary failure in name resolution
2016-05-24 16:09:03 11382 [Warning] IP address '172.31.19.113' could not be resolved: Temporary failure in name resolution
2016-05-24 16:09:14 11382 [Warning] IP address '172.31.19.113' could not be resolved: Temporary failure in name resolution
..........................................................................................................................


解決方法:
在mysql的配置檔案my.cnf中
[mysqld]
節點新增下面兩行


skip-host-cache
skip-name-resolve         


引數解釋如下:
skip-host-cache:禁用主機名快取
skip-name-resolve:禁用主機名解析        



然後重啟MySQL資料庫即可解決:
# service mysqld restart

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/15498/viewspace-2138579/,如需轉載,請註明出處,否則將追究法律責任。

相關文章