当前位置:Gxlcms > 数据库问题 > Access denied for user 'root'@'localhost' (using password: YES)解决方案

Access denied for user 'root'@'localhost' (using password: YES)解决方案

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

想进入数据库,发现进不了,报错Access denied for user ‘root‘@‘localhost‘ (using password: YES)

试了很多方法都不行,后来还是解决了

技术分享

解决方法:

1.先停止mysql

shell># service mysqld stop

2.这段代码的意思大概是在启动
mysql时不启动grant-tables,授权表

shell># mysqld_safe --user=mysql --skip-grant-tables --skip-networking &

 3.进入mysql

shell》# mysql -uroot mysql

4.查看数据库,是否存在mysql数据库并选择mysql数据库

mysql> show databases

mysql> use mysql

5.删除user为空的数据

mysql> delete from user where user=‘‘;

6.重设密码

mysql> update user set Password=PASSWORD(‘你想要设置的密码‘) where user=‘root‘;

7.刷新权限

mysql> flush privileges;

8.退出

mysql> exit;

9.重启mysql

shell># service mysqld restart

10.测试,搞定!

技术分享

 

Access denied for user 'root'@'localhost' (using password: YES)解决方案

标签:start   star   date   存在   table   测试   设置   data   top   

人气教程排行