欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  数据库

MySQL 出现 Access denied for user 'root'@&am_MySQL

程序员文章站 2022-06-14 10:42:11
...
登录某台服务器的mysql时候总报错:

mysql2/client.rb:58:in `connect': Access denied for user 'root'@'localhost' (using password: YES) (Mysql2::Error)

MySQL 出现 Access denied for user 'root'@&am_MySQL

解决方法:

%20在windows%20下的解决方法也一样的

[sql] view%20plaincopyMySQL 出现 Access denied for user 'root'@&am_MySQLMySQL 出现 Access denied for user 'root'@&am_MySQL
  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’;
  5. mysql> FLUSH PRIVILEGES;
  6. mysql> quit
  7. # /etc/init.d/mysqld restart
  8. # mysql -uroot -p
  9. Enter password:
  10. mysql>