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

MySQL 出现 Access denied for user 'root&_MySQL

程序员文章站 2022-05-06 21:52:58
...
bitsCN.com

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

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

MySQL 出现 Access denied for user 'root&amp_MySQL

解决方法:

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

[sql] view plain copy MySQL 出现 Access denied for user 'root&amp_MySQLMySQL 出现 Access denied for user 'root&amp_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>
bitsCN.com