天天看點

mysql 賦權 報錯_MySQL登入報錯-ERROR 1045 (28000)

mysql -uroot -p

輸入設定的密碼

竟然報錯了!

ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YSE)

密碼留白

還是錯誤!

ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)

于是重改密碼!

# /etc/init.d/mysql stop

# mysqld_safe --user=mysql --skip-grant-tables --skip-networking &

mysql

mysql> UPDATE user SET Password=PASSWORD('newpassword') where USER='root';

mysql> FLUSH PRIVILEGES;

假如忘記了登入mysql的root使用者的密碼

#/etc/init.d/mysqld stop

手動啟動資料庫

#mysqld_safe --skip-grant-tables --skip-networking &

#mysql //登入

(這種情況下,就不能使用grant來修改密碼,隻能用update來修改密碼)

>update mysql.user set password=password('123456') where user='root'; //重新修改密碼

#/etc/init.d/mysqld restart //重新開機資料庫

skip-grant-tables //跳過賦權表

skip-networking //跳過網絡