Linux : How to reset MySQL root password

By | July 26, 2012

Lost your root password for MySQL? Follow this simple procedure to reset it. Of course, you need at least root access level on your operating system to proceed.

1. Stop MySQL database server :

2. Start MySQL with “skip grant table” option :

WARNING! This is VERY insecure – while running with this mode, everyone have free access to the whole database server. I do recommend to do it offline or at least block any remote MySQL connection (TCP-3306). You can as well start it without networking support with command :

3. Log into MySQL :

4. Set new password :

5. Stop MySQL :

6. Start MySQL normally :