I was in a situation where we need to backup of a MySql database that was created a long time ago and no one was aware of the password and we need to reset it.
Please follow the following steps, the MySql version is 5.5 on windows server 2012
Open Run and type services.msc
Find the service related to MySql and Stop the service
Make a note of the defaults file which in this case is my.ini
"C:/Program Files/MySQL/MySQL Server 5.5/bin\mysqld" --defaults-file="C:\ProgramData\MySQL\MySQL Server 5.5\my.ini" MySQL
Create a text file with the following text in c:\reset.txt
UPDATE mysql.user SET Password = PASSWORD("P@ssword") WHERE User='root';
Open command prompt and key installation location in my case it is
"C:/Program Files/MySQL/MySQL Server 5.5/bin"
Execute the following command
mysqld --defaults-file="C:\ProgramData\MySQL\MySQL Server 5.5\my.ini" --init-file="c:\reset.txt"
Photo by Taylor Vick on Unsplash
Subscribe to Bala Blog (bala.one) | Sitecore MVP | Sitecore | OrderCloud | Coveo | Azure | SharePoint | O365
Get the latest posts delivered right to your inbox