ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES) 解决访法

环境:centos6.8

mysql版本:5.7

出现的问题:ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)

原因:Linux环境解决Mysql权限不足

$ services mysqld stop

$ mysqld_safe --user=mysql --skip-grant-tables --skip-networking &

$ mysql -u root mysql

mysql>use mysql;

mysql> update user set authentication_string = password('您的新密码'),password_expired = 'N', password_last_changed = now() where user = 'root';//把空的用户密码都修改成非空的密码就行了。

mysql> FLUSH PRIVILEGES;

mysql> quit # /etc/init.d/mysqld restart

$ mysql -uroot -p

Enter password: <输入新设的密码newpassword>

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容