解决mysqlAccess denied for user'root'@'IP地址'问题
生活随笔
收集整理的這篇文章主要介紹了
解决mysqlAccess denied for user'root'@'IP地址'问题
小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.
在按照前面文章中方法搭建Mysql數(shù)據(jù)庫之后,發(fā)現(xiàn)其他機器還是不能訪問,
參考以下文章對權(quán)限進行修改之后,發(fā)現(xiàn)本地機器中root不能訪問了。
http://www.cnblogs.com/ycsfwhh/archive/2012/08/07/2626597.html
后來使用?select host, user, grant_priv from user;
發(fā)現(xiàn)grant_priv一列有問題,只有有g(shù)rant_priv的用戶才能對其他用戶賦予權(quán)限。
修改成以下這樣,就好了。
+-------------------------------------------------+------+------------+ | host | user | grant_priv | +-------------------------------------------------+------+------------+ | % | root | Y | | gzns-ecom-baiduhui-201605-m42n02.gzns.baidu.com | root | Y | | 127.0.0.1 | root | Y | | ::1 | root | Y | | localhost | | N | | gzns-ecom-baiduhui-201605-m42n02.gzns.baidu.com | | N | | localhost | root | N | +-------------------------------------------------+------+------------+?
結(jié)果發(fā)現(xiàn)本機還是連不上:
$ mysql -P8306 -uroot -p123456 ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)再查表看到password這一欄:
mysql> select host, user, Password, grant_priv from user; +-------------------------------------------------+------+-------------------------------------------+------------+ | host | user | Password | grant_priv | +-------------------------------------------------+------+-------------------------------------------+------------+ | % | root | *6BB4837EB74329105EE4568DDA7DC67ED2CA2AD9 | Y | | localhost | root | | Y | | 127.0.0.1 | root | | Y | | ::1 | root | | Y | | localhost | | | N | | gzns-ecom-baiduhui-201605-m42n02.gzns.baidu.com | | | N | | 127.0.0.1 | | *6BB4837EB74329105EE4568DDA7DC67ED2CA2AD9 | N | +-------------------------------------------------+------+-------------------------------------------+------------+ 7 rows in set (0.00 sec)發(fā)現(xiàn)localhost和root這一欄,沒有密碼,所以不用密碼才能登錄:
$ mysql -P8306 -uroot Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 294 Server version: 5.5.30-log Source distributionCopyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.Oracle is a registered trademark of Oracle Corporation and/or its affiliates. Other names may be trademarks of their respective owners.Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.mysql>?
總結(jié)
以上是生活随笔為你收集整理的解决mysqlAccess denied for user'root'@'IP地址'问题的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: web.xml中filter,servl
- 下一篇: iOS 选择的照片或者拍照的图片上添加日