环境: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>
网友评论