How to reset the root user account for a MySQL database


Sometimes you may inherit a MySQL databse server and have no credentials to access anything.  None of the default accounts work.  Your only option is to reset the root user account password.  This is very easy to do.

1. Open up Windows Task Manager and stop the mysqld.exe (MySQL daemon) process.
2. Open up Computer Management > Services > and stop the MySQL service if it isn’t already stopped.
3. Open up a command prompt and go to your MySQL bin folder, for example:

 C:\Program Files\MySQL\MySQL Server 5.1\bin

then type in:

 mysqld.exe –skip-grant-tables

this will restart the MySQL daemon process.

4. Now type in:

 mysql.exe -u root

and it should log you right in as the root user without having to specify a password.

5. Now you need to reset the password.  Type:

 UPDATE mysql.user SET Password=PASSWORD(‘MyNewPassword’) WHERE User=’root’;

You can change the password to whatever you want.  I have set it to “MyNewPassword” above.

6. Now type:


and you’re done!  Try logging in using your new credentials and it should work just fine.  Don’t forget to verify that your MySQL service has been restarted.

About Jason Samuel

Jason Samuel lives in Houston, TX with a primary focus on strategic advisory and architecture of end-user computing, security, enterprise mobility, virtualization, and cloud technologies from Citrix, Microsoft, & VMware. He also has an extensive background in web architecture and networking over his 20+ year career in IT. He is an Author, Speaker, and Local User Group Community Leader. He is certified in several technologies and is 1 of 63 people globally that is a recipient of the prestigious Citrix Technology Professional (CTP) award. He is 1 of 42 people in the world that has been awarded as a VMware EUC Champion and VMware vExpert. He is a featured author on DABCC which provides the latest IT Community News on Cloud, Data Center, Desktop, Mobility, Security, Storage, & Virtualization. In his spare time Jason enjoys writing how-to articles and evangelizing the technologies he works with. Disclaimer: The content and opinions expressed in articles and posts are his own and are by no means associated with his employer.

Recommended for you

Leave a Reply

Your email address will not be published. Required fields are marked *