解決mysql沒法登錄

1、錯誤消息:ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)解決:
一、打開mysql配置文件 /etc/mysql/my.cnf ,添加一行「skip-grant-tables"配置,做用是在mysql啓動時不啓動受權表以便忘記密碼後使用。二、重啓mysql服務,service mysql restart三、命令行輸入「mysql -uroot -p」(不輸入密碼),回車進入數據庫。四、執行 use mysql;」使用mysql數據庫。五、執行 update user set password=PASSWORD("newpassword") where Host='localhost' and user='root';」(修改root的密碼)六、再打開 /etc/mysql/my.cnf ,刪除 skip-grant-tables配置, 保存並關閉文件。七、 重啓mysql服務八、在命令行中輸入「mysql -uroot -p newpassword」,問題搞定! mysql




2、解決修改數據庫賬號密碼、或host時,無效問題 sql


1.使用ssh直接鏈接到數據庫,不要使用工具鏈接 數據庫

2.執行flush privileges  刷新權限 ssh


3、解決1130,遠程訪問權限問題  ide

grant all privileges on *.* to 'root'@'%' identified by 'rootpasswd' with grant option;
工具

相關文章
相關標籤/搜索