解决 MySQL ERROR 1045 (28000): Access denied for user 'root'@'localhost'

Mysql ERROR 1045 (28000): Access denied for user 'root'@'localhost'
Ubuntu 10  mysql 5.1

 

mysql -uroot -p

输入设置的密码

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

mysql -uroot

 还是错误!

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 -uroot -p
Enter password:

mysql>

 

解决。

for more:http://dev.mysql.com/doc/refman/5.5/en/access-denied.html

posted @ 2011-12-29 18:51  邓维  阅读(640)  评论(0编辑  收藏  举报