- Use Linux super administrator privileges and
entersudo su
Enter in the terminal - Enter the database
- Enter
mysql -uroot -p
Enter at the terminal - You are prompted to enter the password, and press Enter directly in the super administrator state to enter the database
- Enter
- Enter in the database
- Modify the mysql root user password:
grant all privileges on *.* to root@localhost identified by '你要设置的密码';
- Refresh the cache:
flush privileges;
- Modify the mysql root user password:
- Password reset complete
Note : After
using this method to modify the default password, there is a chance that it will appear: Use mysql -uroot -p to log in to the database directly with mysql -uroot -p within a few minutes of root privileges (normal accounts do not work), but you will need a password to log in after a few minutes Up.