"Host 'localhost' is not allowed to connect to this MySQL server" 解決辦法
Posted on 2010-10-03 18:00 asdtiang 閱讀(1256) 評(píng)論(0) 編輯 收藏編輯 my.ini linux下為/etc/my.cnf
在[mysqld]的段中加上一句:skip-grant-tables
例如:
[mysqld]
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
skip-name-resolve
skip-grant-tables
目的是為了:
跳過MySQL的訪問控制,任何人都可以在控制臺(tái)以管理員的身份進(jìn)入MySQL數(shù)據(jù)庫。
需要注意的是在修改完密碼以后要把MySQL服務(wù)器停掉重新啟動(dòng)才會(huì)生效
重啟mysql服務(wù)!
OK!
有時(shí)增加用戶時(shí)提示:
ERROR 1045 (28000): Access denied for user.....
得執(zhí)行flush privileges;
#新加用戶服務(wù)xcj,新加的用戶不能馬上生效
mysql> grant all on *.* to xcj@'%' identified by "xcj_passwd";
Query OK, 0 rows affected (0.04 sec)
#生效新加用戶xcj權(quán)限
mysql> flush privileges;
Query OK, 0 rows affected (0.03 sec)
[root@openfire pdf_spider]# mysql -uxcj -p'xcj_passwd'
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 4593
Server version: 5.0.45-log MySQL Community Server (GPL)
Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
mysql>
天蒼蒼,野茫茫,風(fēng)吹草底見牛羊