Hello, If you maybe forget your root MySQL server password, do not panic it can 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.
sudo /etc/init.d/mysqld stop sudo mysqld_safe --skip-grant-tables &
- Reconnect to the MySQL ser
ver with the MySQL root account.
mysql -u root
- Use the followi
ng 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 restart
You’ll now be able to log in again using
mysql -u root -p.
proved to be very easy? I hope this helps 😀