How to reset MySQL root password on Windows

I guess when I initially installed WordPress on my AWS Windows server it installed MySQL without ever giving me the root password for it, just the username and password for the wordpress database.

I tried the instructions in the main MySQL documentation at first. ( It had me shut down mysql and then restart it from the command line, specifying an init file that changed the password for root, but it kep giving me syntax errors.

I found these other instructions that let me restart mysql without a password, and that worked.

First, stop MySql server from services, then use the following command to restart mysql from command

cd “C:\Program Files\MySQL\MySQL Server 5.7\bin”
mysqld –skip-grant-tables –console

Then in another window, manually change the password for root:
mysql -u root
mysql> use mysql;
mysql> update user set password=PASSWORD(“new_password”) where User=’root’;

Then stop and restart mysql
just hit ctrl-c in the window that started mysql without a password, and it will shut it down. (or net stop mysql.)
net start mysql


Leave a Reply

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