ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)总结

##停止mysql服务
# /etc/init.d/mysql stop
# mysqld_safe --user=mysql --skip-grant-tables --skip-networking &
##进入mysql
# mysql -u root mysql
#重新设置root的密码
mysql> UPDATE user SET Password=PASSWORD(“newpassword”) where USER=“root”; 
mysql> FLUSH PRIVILEGES;
mysql> quit
#启动mysql服务
# /etc/init.d/mysql restart
# mysql -uroot -p
Enter password: <输入新密码newpassword>
mysql> quit

你可能感兴趣的:(ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)总结)