解決安裝MySQL時登錄錯誤--error: 'Access denied for user 'root'@'localhost' (using password: YES)'

在使用Linux安裝MySQL登錄時報 :

    mysqladmin: connect to server at 'localhost' failed

   error: 'Access denied for user 'root'@'localhost' (using password: YES)' 錯誤。

解決辦法:破解MySQL密碼 

    1、停止mysql服務:service mysqld stop

    2、執行命令:> mysqld_safe --skip-grant-tables & mysql -uroot -p   按回車進入    跳過權限檢查登錄MySQL
            > use mysql;

            >update user set password=PASSWORD("newpass")where user="root";     更改密碼爲 newpass

            > flush privileges;       更新權限

            > quit   退出

   3、重啓mysql服務: service mysqld restart

   4、鏈接數據庫:mysql -uroot -p newpass


OK了!屢試不爽~

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章