解決MySQL ERROR 1045 (28000)
阿新 • • 發佈:2021-01-20
技術標籤:資料庫
在使用navicat連線資料庫時,報錯資訊:MySQL ERROR 1045 (28000): Access denied for user ‘root’@’localhost’ (using password: YES),
解決方法:
1、修改mysql的登入設定
vim /etc/my.cnf
並在[mysqld]下面新增一句:skip-grant-tables(跳過資料庫許可權驗證)
儲存並退出
重啟mysql並修改密碼
/etc/init.d/mysqld restart
進入mysql
[[email protected]_0_17_centos ~]# mysql use mysql
更新密碼
#mysql5.7之前版本
update user set password=password('root') where user='root';
#mysql5.7版本
update user set authentication_string=password('root') where user='root';
flush privileges;
3、再次修改 /etc/my.cnf
將skip-grant-tables 刪除 儲存退出
4、再次啟動mysql就可以正常使用
service mysqld start