Access denied for user 'root'@'localhost' (using password:YES) 解决方案

在终端按步执行以下命令:

/etc/init.d/mysql stop

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

mysql -u root mysql

update mysql.user set authentication_string=password('密码') where user='root';

FLUSH PRIVILEGES;

quit

/etc/init.d/mysql restart

mysql -uroot -p

Enter password: 密码

 

posted @ 2018-09-12 16:20  王家俊  阅读(53)  评论(0)    收藏  举报