Mysql ERROR 1045 (28000): Access denied for user 'root'@'localhost'

 
Mysql ERROR 1045 (28000): Access denied for user '
 
 


                       
Mysql ERROR 1045 (28000): Access denied for user 'root'@'localhost'
                
                                                  centos5.5刚装了mysql

1、安装成功了,安装最后要求输入了密码,也输入了,OK
mysql -uroot -p
输入设置的密码
竟然报错了!
2、ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YSE)
初始密码是空的,可我设置了密码的阿。
密码留空
还是错误!
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)
3、于是重改密码!
# /etc/init.d/mysql stop
# mysqld_safe --user=mysql --skip-grant-tables --skip-networking &
# mysql -u root mysql
mysql> update user set password=password('147258369') where user='root';
Query OK, 3 rows affected (0.00 sec)
Rows matched: 3  Changed: 3  Warnings: 0
mysql> quit

 

ctrl+c退出

4、重启MySQL
# /etc/init.d/mysql restart
# mysql -u root -p
Enter password:
mysql>
搞定! OK.....................................

你可能感兴趣的:(Mysql ERROR 1045 (28000): Access denied for user 'root'@'localhost')