illmob.org

MySQL password reset

March 21st, 2008 by Dev Team in Password Info

Don’t know the root-level password for MySQL? Or just plain forgot it?

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)

Leave a reply