mysql forget root password under linux
1. Close the mysql service
service mysqld stop
2. Modify the mysql configuration File
Modify /etc/my.cnf and add
skip-grant-tables ##忽略mysql权限问题,直接登录
after modification
service mysqld start; mysql -u root -p
mysql> update mysql.user set password=PASSWORD('new_password') where User='root'; mysql> flush privileges; mysql> quit;
service mysqld restart;
mysql tutorial 》
The above is the detailed content of What should I do if I forget the root password of mysql database under Linux?. For more information, please follow other related articles on the PHP Chinese website!