How to reset MySql admin password
February 16, 2008
Leave a comment
Being a full time .net developer, I do most of my database related development in SQL Server. I recently moved to WordPress which use MySql as database. When I was setting up my new blog, I found that MySQL is already installed there but the password is not mentioned anywhere in the hosting docs. Now, in SQL Server by default the windows authentication is enabled. So you can easily login and change the password for sa.
But, for MySQL I found this interesting way:
- Go to Administrative tools -> Services and stop the ‘MySql’ service
- From command prompt, run Mysql\bin\mysqld-nt.exe” -P3306 –skip-grant-tables
- Open another command prompt and run mysql(\Mysql\bin\mysql.exe” -P3306 mysql)
- Now you can update mysql.user table to change the password for admin.
For ex: update mysql.user set password=password(’new_password’) where user=’admin’ - Finally, you can close the prompts and kill the mysqld-nt.exe process from task manager and restart the service.