Hello, If you maybe forget your root MySQL server password, do not panic it ca
n be flushed and then reset very easily
- Stop the current MySQL server instance, then restart it with an option to not ask for a password.
c/init.d/mysqld stop sudo mysqld_safe --skip-grant-tables &
- Reconnect to the MySQL server with the MySQL root account.
mysql -u root
- Use the following commands to reset root’s password. Replace
passwordwith a strong password.
1 2 3 4
use mysql; update user SET PASSWORD=PASSWORD("yorsnewpassword") WHERE USER='root'; flush privileges exit
- Then restart MySQL.
sudo service mysqld
You’ll now be able to log in again using
mysql -u root -p.
proved to be very easy? I hope this helps 😀