日本三级片在线观看视频_西西大胆午夜人体视频无码_少妇无码一区二区_亚洲天堂超碰_极品少妇被猛的白浆直流_91精品云霸高清中文字幕_草草五月天伊人_久久少妇无码专区_欧美激欧美啪啪5老太_日韩在线在线成人

幫助中心 >  技術(shù)知識庫 >  數(shù)據(jù)庫 >  相關(guān)技術(shù)支持 >  windows下本地或者遠(yuǎn)程連接MYSQL數(shù)據(jù)庫報(bào)1130錯(cuò)誤的解決方法

windows下本地或者遠(yuǎn)程連接MYSQL數(shù)據(jù)庫報(bào)1130錯(cuò)誤的解決方法

2017-02-25 13:34:12 13919

重裝MySQL,由于不知道重裝之前的root密碼,使用重裝之后的密碼連接Mysql數(shù)據(jù),總報(bào) ERROR 1130: host 'localhost' not allowed to connect to this MySQLserver,不能連接數(shù)據(jù)庫,猜測用戶權(quán)限和密碼的問題。

1、用root用戶登錄mysql數(shù)據(jù)庫

1)停止MySQL服務(wù),執(zhí)行net stop mysql;

2)在mysql的安裝路徑下找到配置文件my.ini

找到[mysqld],輸入:skip-grant-tables,保存。

3)重啟mysql服務(wù),net start mysql

4)執(zhí)行mysql -uroot -p,回車,再回車,即可進(jìn)?mysql數(shù)據(jù)庫;

2、在本機(jī)登入mysql后,更改 “mysql” 數(shù)據(jù)庫里的 “user” 表里的 “host” 項(xiàng),從”localhost”改稱'%'

mysql>use mysql;

mysql>select host,user,password from user;

mysql>update user set host = '%' where user ='root';

mysql>flush privileges;    #刷新用戶權(quán)限表

mysql>select host,user,password  from user where user='root';

     3、插入本地登錄的用戶

mysql>insert into user values('localhost', 'root', '', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y','','','','',0,0,0,0,'','');

此時(shí)本地連接的用戶localhost密碼為空

     4、修改root密碼

1)用set password 方式修改root密碼遇到錯(cuò)誤ERROR 1290 (HY000)

mysql> set password for root@'localhost'=PASSWord('12345');
ERROR 1290 (HY000): The MySQL server is running with the --skip-grant-tables option so it cannot execute this statement

注意:以skip-grant-tables方式啟動mysql后,不能用直接用set password的方式修改root密碼,須注釋skip-grant-tables 然后重啟服務(wù),連接數(shù)據(jù)庫修改密碼

2)用update方式修改root密碼正常

mysql> update user set password=password("123") where user="root";

mysql>flush privileges; 

   3)不連接數(shù)據(jù)庫,直接在cmd下修改密碼

mysqladmin -uroot -p舊密碼 password 新密碼

此種方式修改密碼也不能在以“skip-grant-tables“方式啟動mysql后進(jìn)行:

mysqladmin -uroot -p123456 password 1234

5、退出MySQL,在配置文件中注釋:skip-grant-tables,重啟mysql服務(wù)

6、本地重新連接mysql數(shù)據(jù)庫,輸入修改后的密碼,連接成功。


提交成功!非常感謝您的反饋,我們會繼續(xù)努力做到更好!

這條文檔是否有幫助解決問題?

非常抱歉未能幫助到您。為了給您提供更好的服務(wù),我們很需要您進(jìn)一步的反饋信息:

在文檔使用中是否遇到以下問題: