環(huán)境:centos6.8
mysql版本:5.7
出現(xiàn)的問題:ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)
原因:Linux環(huán)境解決Mysql權(quán)限不足
$ 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: <輸入新設(shè)的密碼newpassword>