您好,登錄后才能下訂單哦!
本篇內容介紹了“mysql啟用skip-name-resolve模式時出現Warning怎么解決”的有關知識,在實際案例的操作過程中,不少人都會遇到這樣的困境,接下來就讓小編帶領大家學習一下如何處理這些情況吧!希望大家仔細閱讀,能夠學有所成!
查看mysql告警日志,發現兩個警告,如下紅體字
[root@S243 ~]# tail -f /mysql/datadir/S243.err
2017-02-15 08:59:57 23433 [Warning] 'user' entry 'root@s243' ignored in --skip-name-resolve mode.
2017-02-15 08:59:57 23433 [Warning] 'proxies_priv' entry '@ root@s243' ignored in --skip-name-resolve mode.
2017-02-15 09:00:00 23433 [Warning] 'user' entry 'root@s243' ignored in --skip-name-resolve mode.
2017-02-15 09:00:00 23433 [Warning] 'proxies_priv' entry '@ root@s243' ignored in --skip-name-resolve mode.
2017-02-15 09:22:58 23433 [Warning] 'user' entry 'root@s243' ignored in --skip-name-resolve mode.
2017-02-15 09:22:58 23433 [Warning] 'proxies_priv' entry '@ root@s243' ignored in --skip-name-resolve mode.
2017-02-15 09:23:03 23433 [Warning] 'user' entry 'root@s243' ignored in --skip-name-resolve mode.
2017-02-15 09:23:03 23433 [Warning] 'proxies_priv' entry '@ root@s243' ignored in --skip-name-resolve mode.
網上搜到一篇文章。。。。。。,驗證確實解決了問題,于是粘過來做個記錄。
http://www.justwinit.cn/post/7539/
[實踐OK]mysql啟用skip-name-resolve模式時出現Warning的處理辦法
背景:skip-name-resolve 參數的目的是不再進行反解析(ip不反解成域名),這樣可以加快數據庫的反應時間。修改配置文件添加并需要重啟:[mysqld] skip-name-resolve添加后發現錯誤日志有警告信息:
[root@jackxiang mysql]# vi my.cnf
skip-name-resolve
# 禁止MySQL對外部連接進行DNS解析,使用這一選項可以消除MySQL進行DNS解析的時間。但需要注意,如果開啟該選項,
# 則所有遠程主機連接授權都要使用IP地址方式,否則MySQL將無法正常處理連接請求
實踐如下:
重啟mysql,發現日志還有:
1)按提示作下查詢,果然有一個空賬戶和root帳戶的Host是jackxiang:
select * from user where Host="jackxiang"\G;
mysql> select Host,User,Password from user where Host="jackxiang";
+-----------+------+-----------------------------------------------------+
| Host | User | Password |
+-----------+------+-----------------------------------------------------+
| jackxiang | | |
| jackxiang |root | *2CD42BDFDF0EB0E*Z****3458EB72EE1F17F26F |
+-----------+------+------------------------------------------------------+
2)查下localhost,因為大都是限定本機連接,不讓外面機器連接,確保安全:
mysql> select Host,User,Password from user where Host="localhost" limit 2;
+-----------+-----------------+-------------------------------------------+
| Host | User | Password |
+-----------+-----------------+-------------------------------------------+
| localhost | | |
| localhost | jack_mysql | *2CD42BDFDF0E***3458EB72EE1F17F26F |
+-----------+-----------------+-------------------------------------------+
3)把Host既是 jackxiang的,用戶是空或root的Host修改為localhost:
mysql> update user set Host="localhost" where Host="jackxiang";
ERROR 1062 (23000): Duplicate entry 'localhost-' for key 'PRIMARY'
這樣搞不行,得一個一個干掉,看有沒有root同名的,查下:
mysql> select Host,User,Password from user where User="";
+-----------+------+----------+
| Host | User | Password |
+-----------+------+----------+
| localhost | | |
| jackxiang | | |
+-----------+------+----------+
mysql> delete from user where User="" and Password="";
Query OK, 2 rows affected (0.01 sec)
4)查下user為root的
mysql> select Host,User,Password from user where User="root";
+-----------+------+-------------------------------------------+
| Host | User | Password |
+-----------+------+-------------------------------------------+
| localhost | root | *2CD42BDFDF0EB0E1A7777777777EE1F17F26F |
| jackxiang | root | *2CD42BDFDF0EB0E1A7777777777EE1F17F26F |
| 127.0.0.1 | root | *2CD42BDFDF0EB0E1A7777777777EE1F17F26F |
| ::1 | root | *2CD42BDFDF0EB0E1A7777777777EE1F17F26F |
+-----------+------+-------------------------------------------+
5)留下localhost就足夠了,其余刪除掉:
mysql> delete from user where Host !="localhost" and User="root";
Query OK, 3 rows affected (0.00 sec)
6)restart mysql:
日志warning還有一個:
[Warning] 'proxies_priv' entry '@ root@jackxiang' ignored in --skip-name-resolve mode.
解決辦法:
然后刪除表mysql.proxies_priv中和cvs類似與具體域名有關的行,方法同上。
mysql> select Host,User,Proxied_host,Proxied_user,With_grant,Grantor,Timestamp from proxies_priv ;
+-----------+------+--------------+--------------+------------+---------+----------------+
| Host | User | Proxied_host | Proxied_user | With_grant | Grantor | Timestamp |
+-----------+------+--------------+--------------+------------+---------+----------------+
| localhost | root | | | 1 | | 2014-07-14 13:26:08 |
| jackxiang | root | | | 1 | | 2014-07-14 13:26:08 |
+-----------+------+--------------+--------------+------------+---------+----------------+
mysql> delete from proxies_priv where Host="jackxiang";
Query OK, 1 row affected (0.02 sec)
這下徹底清靜了。
原來是當時安裝mysql后,多次grant授權引起的,。
備注:
skip-name-resolve是禁用dns解析,避免網絡DNS解析服務引發訪問MYSQL的錯誤,一般應當啟用。 啟用后,在mysql的授權表中就不能使用主機名了,只能使用IP ,出現此警告是由于mysql 表中已經存在有 root@jackxiang 帳號信息。 我們把它刪除就好了。 mysql>use mysql; mysql> delete from user where HOST='localhost.localdomain'; Query OK, 2 rows affected (0.00 sec) 重啟MYSQL ,發現警告已經沒有啦。
“mysql啟用skip-name-resolve模式時出現Warning怎么解決”的內容就介紹到這里了,感謝大家的閱讀。如果想了解更多行業相關的知識可以關注億速云網站,小編將為大家輸出更多高質量的實用文章!
免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。