Mysql ERROR 1045 (28000): Access denied for user

http://linux.chinaunix.net/techdoc/database/2008/11/25/1047550.shtmlhtml

sudo apt-get install mysql
安裝成功了,安裝最後要求輸入了密碼,也輸入了,OK
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 -u root mysql
mysql> UPDATE user SET Password=PASSWORD('newpassword') where USER='root';
mysql> FLUSH PRIVILEGES;
mysql> quit
# /etc/init.d/mysqld restart
# mysql -u root -p
Enter password:
mysql>
搞定!mysql

相關文章
相關標籤/搜索