当前位置:Gxlcms >
mysql >
MySQL出现Accessdeniedforuser'root&_MySQL
MySQL出现Accessdeniedforuser'root&_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
- # /etc/init.d/mysqld stop
- # mysqld_safe --user=mysql --skip-grant-tables --skip-networking &
- # mysql -u root mysql
- mysql> UPDATE user SET Password= PASSWORD(’newpassword’) where USER=’root’;
- mysql> FLUSH PRIVILEGES;
- mysql> quit
- # /etc/init.d/mysqld restart
- # mysql -uroot -p
- Enter password: <输入新设的密码newpassword>
- mysql>
bitsCN.com