我在我的Linux服务器上安装了MySQL,但忘记了它的密码,于是我按照网上找到的方法进行了更改。我的操作如下:
/etc/init.d/mysql stop
mysqld_safe --skip-grant-tables &
mysql --user root mysql
SELECT * FROM user; // I checked if I could access the user table or not
update user SET password = PASSWORD('new_pass') WHERE user = 'root';
flush privileges;
exit
更新查询确实更改了密码,因为它向我显示了受影响的行数和查询 OK 等信息。
然后我重新启动了mysql。
/etc/init.d/mysql stop
/etc/init.d/mysql start
现在,当我使用新密码登录时
mysql -u root -p new_pass
我仍然收到错误消息"ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: Yes)"
我是否漏掉了什么?