Mysql部署各種問(wèn)題解決大法—問(wèn)題#1045 無(wú)法登錄 MySQL 服務(wù)器
#1045 無(wú)法登錄 MySQL 服務(wù)器
出現(xiàn)這些問(wèn)題都可以用此方法
在本地?zé)o法連接服務(wù)器
phpMyAdmin無(wú)法登錄
修改root密碼

解決方法
1.停止mysql數(shù)據(jù)庫(kù)
/etc/init.d/mysqld stop
(或者直接 kill -9 [PID] 殺進(jìn)程?。?/strong>
2.執(zhí)行如下命令mysqld_safe --user=mysql --skip-grant-tables --skip-networking &
3.使用root登錄mysql數(shù)據(jù)庫(kù)mysql -u root mysql
4.更新root密碼mysql> UPDATE user SET Password=PASSWORD('newpassword') where USER='root';
最新版MySQL請(qǐng)采用如下SQL:mysql> UPDATE user SET authentication_string=PASSWORD('newpassword') where USER='root';
5.刷新權(quán)限mysql> FLUSH PRIVILEGES;
6.退出mysqlmysql> quit
7.重啟mysql/etc/init.d/mysqld restart
8.使用root用戶重新登錄mysqlmysql -uroot -p Enter password: <輸入新設(shè)的密碼newpassword>
不知道如何在終端操作,請(qǐng)看一下截圖:

標(biāo)簽: