MySQL 出现 Access denied for user 'root'@'localhost' (using password: YES) 错误
登录某台服务器的mysql时候总报错:
mysql2/client.rb:58:in `connect': Access denied for user 'root'@'localhost' (using password: YES) (Mysql2::Error)
解决方法:
在windows 下的解决方法也一样的
- # /etc/init.d/mysqld 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: <输入新设的密码newpassword>
- mysql>