一、問題
有時候我們登錄Mysql輸入密碼的時候,會出現(xiàn)這種情況
mysql -u root -p?
Enter Password > '密碼'
錯誤:ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)
或者:錯誤:ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)
二、解決辦法
修改my.in/my.cnf配置文件
進入mysql安裝目錄
編輯my.ini
在[mysqld]下添加skip-grant-tables,保存即可。
使用管理員身份打開命令行
?、僦貑ysql:
1、net stop mysql??? 2、net start mysql??
②進入mysql,登錄
mysql -u root -p
不用輸入密碼,直接回車(出現(xiàn)Enter Password 也一樣直接回車,即可登陸成功)
?、圯斎?strong>use mysql,修改root的密碼:
update user set authentication_string=password('新密碼') where user='root';
flush privileges;
?、芡顺觯?/p>
quit;
⑤再次重啟mysql:
1、net stop mysql? ? ?2、net start mysql
?、逌y試是否成功就是是否登陸成功咯。
mysql -u root -p
Enter Password>'新密碼'
就不會出錯,可以登錄啦!?。?mark hidden color="red">文章來源:http://www.zghlxwxcb.cn/news/detail-720912.html
(另外一種情況就是,,你密碼輸入錯誤了,如果是初始化后第一次登錄,出現(xiàn)這種情況的話,很大概率就是密碼錯誤,初始化后的密碼要認真查看,可能會因為空格、小數(shù)點等符號輸錯)文章來源地址http://www.zghlxwxcb.cn/news/detail-720912.html
到了這里,關(guān)于解決mysql:ERROR 1045 (28000): Access denied for user ‘root‘@‘localhost‘ (using password: NO/YES)的文章就介紹完了。如果您還想了解更多內(nèi)容,請在右上角搜索TOY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!