解決辦法
1. 管理員登陸系統(tǒng),停止mysql服務(wù)或者結(jié)束mysqld-nt進程;
2. 進入命令行,來到mysql的安裝目錄.假設(shè)安裝目錄為 d:mysql , CMD進入命令行;
3. 運行 D:Program FilesMySQLMySQL Server 5.5binmysqld-nt --skip-grant-tables啟動mysql,關(guān)閉權(quán)限的檢查;
4. 運行 D:Program FilesMySQLMySQL Server 5.5binmysqladmin -u root flush-privileges password "newpassword" 重設(shè)root密碼;
5. 重新啟動mysql服務(wù);
方法一:
# /data/mysql/bin/mysqladmin -u -p <首先要停止你之前的啟動的mysql.如果停止的時候.也出現(xiàn)1045的錯誤的話那只有kill掉mysql的pid><br>
# mysqld_safe --user=mysql --skip-grant-tables --skip-networking &<br>
# mysql -u root mysql<br>
mysql> UPDATE user SET Password=PASSWORD('newpassword') where USER='root';<br>
mysql> FLUSH PRIVILEGES;<br>
mysql> quit
# /etc/init.d/mysql restart<br>
# mysql -uroot -p<br>
Enter password: <輸入新設(shè)的密碼newpassword>
mysql>
解決方法二
首先計入到mysql的客戶端命令行。
然后
grant all privileges on *.* to 'root'@'localhost' identified by '你的密碼' with grant option;
flush privileges;
執(zhí)行完這兩條命令之后就可以了
如對本文有疑問,請?zhí)峤坏浇涣髡搲瑥V大熱心網(wǎng)友會為你解答?。?點擊進入論壇