mysql: Access denied for user

2383阅读 0评论2012-08-03 liujunwei1234
分类:Mysql/postgreSQL

    今天在使用mysql的时候,碰到如下错误:

  1. Access denied for user 'root'@'localhost' (using password: YES)
google了下,这种问题还挺普遍了的,试了一种解决方法也OK,在此记录下,以备使用。

  1. # /etc/init.d/mysqld stop
  2. # mysqld_safe --user=mysql --skip-grant-tables --skip-networking &
  3. # mysql -u root mysql
  4. mysql> UPDATE user SET Password=PASSWORD('newpassword') where USER='root' and host='root' or host='localhost';
  5. mysql> FLUSH PRIVILEGES;
  6. mysql> quit
  7. # /etc/init.d/mysql restart
  8. # mysql -uroot -p
  9. Enter password: <输入新设的密码newpassword>

上一篇:cgroup介绍、安装和配置文件解析
下一篇:opennebula源码分析之框架分析