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 USAGE ON *.* TO 'root'@'localhost' IDENTIFIED BY 'YourPassword' WITH GRANT OPTION;

 


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM