How to reset the forgotten MySql root password


In this MySql tutorial we will learn how to reset the forgotten MySql root password.





1) In windows, Go to start, run (Windows + r), and type Services.msc.
And Stop MySql service.



2) Go to CMD and go to C:\Program Files\MySQL\MySQL Server 5.6\bin folder.
and type mysqld.exe -u root --skip-grant-tables

C:\Program Files\MySQL\MySQL Server 5.6\bin>mysqld.exe -u root --skip-grant-tables
2015-11-10 23:59:54 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated.
2015-11-10 23:59:54 0 [Note] mysqld.exe (mysqld 5.6.25) starting as process 7452 ...


Let this CMD(command prompt) window open
and
open another CMD (command prompt)  window.


3) In another CMD window again go to C:\Program Files\MySQL\MySQL Server 5.6\bin folder.
and type mysql

C:\Program Files\MySQL\MySQL Server 5.6\bin>mysql
Welcome to the MySQL monitor.  Commands end with ; or \g.

mysql>


4) Then type use mysql; to switch to mysql database.

mysql> use mysql;
Database changed
mysql>


5) Then update and set password using
UPDATE user SET Password = PASSWORD('new-password') WHERE User = 'root';

mysql> UPDATE user SET Password = PASSWORD('new-password') WHERE User = 'root';
Query OK, 3 rows affected (0.00 sec)
Rows matched: 3  Changed: 3  Warnings: 0

mysql>

6) Press CTRL+C to exit first CMD(command prompt) window.

7) Press exit! to exit second  CMD(command prompt) window.


You are done, password for MySql user root has been changed! You can again start the MySql services.


So in this MySql tutorial we learned how to reset the forgotten MySql root password.

Related >>

select rows between one number to another in MySql tutorial

How to change the MySql user(root) password tutorial


Labels: Core Java MySql
eEdit
Must read for you :