本篇內(nèi)容介紹了“MySQL啟用skip-name-resolve模式時(shí)出現(xiàn)Warning怎么解決”的有關(guān)知識,在實(shí)際案例的操作過程中,不少人都會遇到這樣的困境,接下來就讓小編帶領(lǐng)大家學(xué)習(xí)一下如何處理這些情況吧!希望大家仔細(xì)閱讀,能夠?qū)W有所成!
創(chuàng)新互聯(lián)致力于網(wǎng)站設(shè)計(jì)、網(wǎng)站制作,成都網(wǎng)站設(shè)計(jì),集團(tuán)網(wǎng)站建設(shè)等服務(wù)標(biāo)準(zhǔn)化,推過標(biāo)準(zhǔn)化降低中小企業(yè)的建站的成本,并持續(xù)提升建站的定制化服務(wù)水平進(jìn)行質(zhì)量交付,讓企業(yè)網(wǎng)站從市場競爭中脫穎而出。 選擇創(chuàng)新互聯(lián),就選擇了安全、穩(wěn)定、美觀的網(wǎng)站建設(shè)服務(wù)!
查看mysql告警日志,發(fā)現(xiàn)兩個(gè)警告,如下紅體字
[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.
網(wǎng)上搜到一篇文章。。。。。。,驗(yàn)證確實(shí)解決了問題,于是粘過來做個(gè)記錄。
http://www.justwinit.cn/post/7539/
[實(shí)踐OK]mysql啟用skip-name-resolve模式時(shí)出現(xiàn)Warning的處理辦法
背景:skip-name-resolve 參數(shù)的目的是不再進(jìn)行反解析(ip不反解成域名),這樣可以加快數(shù)據(jù)庫的反應(yīng)時(shí)間。修改配置文件添加并需要重啟:[mysqld] skip-name-resolve添加后發(fā)現(xiàn)錯(cuò)誤日志有警告信息:
[root@jackxiang mysql]# vi my.cnf
skip-name-resolve
# 禁止MySQL對外部連接進(jìn)行DNS解析,使用這一選項(xiàng)可以消除MySQL進(jìn)行DNS解析的時(shí)間。但需要注意,如果開啟該選項(xiàng),
# 則所有遠(yuǎn)程主機(jī)連接授權(quán)都要使用IP地址方式,否則MySQL將無法正常處理連接請求
實(shí)踐如下:
重啟mysql,發(fā)現(xiàn)日志還有:
1)按提示作下查詢,果然有一個(gè)空賬戶和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,因?yàn)榇蠖际窍薅ū緳C(jī)連接,不讓外面機(jī)器連接,確保安全:
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'
這樣搞不行,得一個(gè)一個(gè)干掉,看有沒有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還有一個(gè):
[Warning] 'proxies_priv' entry '@ root@jackxiang' ignored in --skip-name-resolve mode.
解決辦法:
然后刪除表mysql.proxies_priv中和cvs類似與具體域名有關(guān)的行,方法同上。
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)
這下徹底清靜了。
原來是當(dāng)時(shí)安裝mysql后,多次grant授權(quán)引起的,。
備注:
skip-name-resolve是禁用dns解析,避免網(wǎng)絡(luò)DNS解析服務(wù)引發(fā)訪問MYSQL的錯(cuò)誤,一般應(yīng)當(dāng)啟用。 啟用后,在mysql的授權(quán)表中就不能使用主機(jī)名了,只能使用IP ,出現(xiàn)此警告是由于mysql 表中已經(jīng)存在有 root@jackxiang 帳號信息。 我們把它刪除就好了。 mysql>use mysql; mysql> delete from user where HOST='localhost.localdomain'; Query OK, 2 rows affected (0.00 sec) 重啟MYSQL ,發(fā)現(xiàn)警告已經(jīng)沒有啦。
“mysql啟用skip-name-resolve模式時(shí)出現(xiàn)Warning怎么解決”的內(nèi)容就介紹到這里了,感謝大家的閱讀。如果想了解更多行業(yè)相關(guān)的知識可以關(guān)注創(chuàng)新互聯(lián)網(wǎng)站,小編將為大家輸出更多高質(zhì)量的實(shí)用文章!