Here is the procedure to reset password of root user.
1) Stop mysql (Kill mysql process or run following command)
sudo /usr/local/mysql/support-files/mysql.server stop
2) Start it in safe mode
sudo mysqld_safe --skip-grant-tables
3) Open another terminal and run the following command (Keep last terminal open)
mysql -u root
4) Run the following command with suitable new password on the mysql console
mysql > UPDATE mysql.user SET Password=PASSWORD('password') WHERE User='root';
5) mysql
> FLUSH PRIVILEGES;
6) Quit from both terminals and open new terminal and connect to mysql with root user and new password
mysql -uroot -p
本文提供了详细的步骤来帮助用户在忘记MySQL root用户密码时进行重置。包括停止MySQL服务、以安全模式启动、更新root用户的密码等关键操作。
192

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



