Reset Mysql root password on windows

No Comments

reseting a mysql password on windows

1.  stop mysql

2.  Open a command prompt by selecting Start>   run>   typing in cmd

3.  Changed directory to C:\program files\mysql\MySQL Server 5.1_orig\bin by running
cd “C:\program files\mysql\MySQL Server 5.1_orig\bin”

4.  Started mysql from the command line with:
mysqld –defaults-file=”C:\Program Files\MySQL\MySQL Server 5.1\my.ini” –skip-grant-tables

5.  Opened a 2nd command prompt

6.  Changed directory to C:\program files\mysql\MySQL Server 5.1_orig\bin

7.  log into mysql by typing
mysql

8.  select the database
USE mysql

9.  update the password
UPDATE user SET password=(‘ ‘) WHERE user=’root’;

10. exit mysql

11. kill the mysql service running in the first command prompt with
taskkill /F /IM mysqld.exe

12. Start mysql normally

13.  from the command prompt or the mysql command line client connect to mysql
mysql -uroot -p
just hit enter for the password

14.  update permissions
GRANT all on *.* to root@’localhost’ identified BY ‘newpassword’;
GRANT all on *.* to root@’%’ identified BY ‘newpassword’;
flush PRIVILEGES;

15. exited out of mysql

16.  tested new password with
mysql -uroot -p
this time entering the password specified.

Leave a Reply