root用户无法访问Mysql数据库问题的解决

在使用Centos系统远程访问Mysql数据库的时候,系统提示报如下错误:

Access Denied for User 'root'@'localhost' (using password: YES) - No Privileges?

经过验证以下方案可以解决问题:

1.首先停止mysql服务器

sudo service mysqld stop

2.无权限启动mysql服务

sudo service mysqld start --skip-grant-tables

3..登录mysql

mysql

4..重新载入权限

FLUSH PRIVILEGES;

5.. 选择系统数据库mysql

use mysql;

6..查询系统表user中的用户

select host,user,authentication_string from user;

7.向root用户赋值权限

GRANT ALL PRIVILEGES ON *.* TO 'root'@'localhost' WITH GRANT OPTION;

版权声明:
作者:郭靖
链接:https://www.sxszhian.com/archives/9067
来源:上海永驰网络科技有限公司
文章版权归作者所有,未经允许请勿转载。

THE END
分享
二维码
打赏
< <上一篇
下一篇>>