Changing MySql Database root Password

By | 21/09/2012

To change MySql database root password We have to restart MySql server with skip_grant_table option.

Edit my.cnf for linux file or my.ini file for windows and add following line in this file.


Then restart MySql Service. After restart you can log in MySql server without using password.

Change root password by running.

UPDATE mysql.user SET Password=PASSWORD('New_Password') WHERE User='root';

Remove skip_grant_table option and restart MySql. After that you can use your new password.