ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)
于是重改密码!
# /etc/init.d/mysql stop
# mysqld_safe --user=mysql --skip-grant-tables --skip-networking &
# mysql -u root mysql
mysql> UPDATE user SET Password=PASSWORD('newpassword') where USER='root';
mysql> FLUSH PRIVILEGES;
mysql> quit
# /etc/init.d/mysqld restart
# mysql -uroot -p
Enter password:
mysql>
于是重改密码!
# /etc/init.d/mysql stop
# mysqld_safe --user=mysql --skip-grant-tables --skip-networking &
# mysql -u root mysql
mysql> UPDATE user SET Password=PASSWORD('newpassword') where USER='root';
mysql> FLUSH PRIVILEGES;
mysql> quit
# /etc/init.d/mysqld restart
# mysql -uroot -p
Enter password:
mysql>
本文介绍了一种当遇到MySQL登录错误时重置root用户密码的方法。具体步骤包括:停止MySQL服务,启动MySQL服务并跳过权限表检查,更新root用户的密码,刷新权限,重启MySQL服务。
1万+

被折叠的 条评论
为什么被折叠?



