MySQL is one of the world's most popular open source database. It is mainly used on many database enabled website mostly for being free, and powerful.
If you happen to lose your MySQL
root password, you can follow these steps to reset it.
To run MySQL in safe mode, you will first need to stop all the running instances, and start it back in safe mode. This can be achieved by running the following commands;
sudo /etc/init.d/mysql stop sudo mysqld_safe --skip-grant-tables
You can now login as
root user, without password. You can use the following command to do that
mysql -u root mysql
Once logged in as
root, you can now set a new password for your
root account by running these commands at your MySQL console.
mysql> update user set Password=PASSWORD('desiredpassword') where User = 'root'; mysql> flush privileges;
desiredpassword to the password you want to set your
root account to.
Kill the current MySQL daemon via the following command and (re)start MySQL service.
sudo killall mysqld
Comment anonymously. Login not required.