站内搜索

MySQL 出现 Access denied for user 'root&amp_MySQL

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
  • 上一篇:DB Browser的使用_MySQL
  • 下一篇:Java使用JDBC连接任意类型数据库(mysqloracle。。)_MySQL