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

MySQL出现Accessdeniedforuser'root&amp_MySQL

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

bitsCN.com

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

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

解决方法:

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

[sql] view plain copy 在CODE上查看代码片 派生到我的代码片

  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>
bitsCN.com

人气教程排行