当前位置:Gxlcms > mysql > MySQL出现Accessdeniedforuser'root'@&am_MySQL

MySQL出现Accessdeniedforuser'root'@&am_MySQL

时间:2021-07-01 10:21:17 帮助过:27人阅读

登录某台服务器的mysql时候总报错:

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

解决方法:

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

[sql] view%20plaincopy派生到我的代码片
  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: <输入新设的密码newpassword>
  10. mysql>

人气教程排行