Resetting the root password for MySQL

From JoatWiki
Jump to: navigation, search

Following method allows you to reset the root password for you MySQL database.

1) As root, stop the MySQL daemon (example: service mysqld stop)

2) Start MySQL via

mysqld_safe --skip-grant-tables &

3) Connect to MySQL via

mysql -u root

4) Run the following

use mysql;
update user set password=PASSWORD("yournewpassword") where User='root';
flush privileges;

5) Kill mysqld_safe and restart MySQL normally (example: service mysqld start)


<comments>Resetting_the_root_password_for_MySQL</comments>

Personal tools