忘記mysql root密碼,或者不知道密碼
報(bào)錯(cuò):
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES
解決方案:
首先關(guān)閉mysql服務(wù)
service mysqld restart
在[mysqld]的中插入:
skip-grant-tables

重啟mysql服務(wù):
service mysqld restart
進(jìn)入mysql:
mysql
選擇mysql數(shù)據(jù)庫(kù):
use mysql;
修改root密碼:
UPDATE user SET authentication_string = password ( 'newPasswd' ) WHERE User = 'root'
刷新mysql權(quán)限:
flush privileges;
退出mysql后重啟mysql服務(wù)就可以正常使用了。
想要修改用戶權(quán)限時(shí),發(fā)現(xiàn)了如下錯(cuò)誤
ERROR 1820 (HY000): You must reset your password using ALTER USER statement before executing this statement.
解決方法:
set password=password('A1an_Tur!ng3');
mysql允許root遠(yuǎn)程登陸()
grant all privileges on *.* to root@'%' identified by 'A1an_Tur!ng3';
刷新mysql權(quán)限:
flush privileges;