在使用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了!屢試不爽~