Saturday, January 6, 2018

How to reset Mysql Root Password

how to reset the forgotten Mysql database root password which doesn’t affect any databases.


First, We need to stop the service and process of Mysql running on the server.To do this, Use the command.

#service mysqld stop.


Now, We need to initiate MySQL process without asking any password using the command,

#mysqld_safe –skip-grant-tables &

When we run the above command, Mysql process will allow us to login to the MySQL server without any password.

Wait for few minutes and press Enter.

Now, It’s time to login to database as root user but without password,

#mysql -u root

You will be allowed to log in to the database.

Now, Let’s list the available databases.

mysql>show databases;

We have to choose mysql database for setting up the new password for root user.


Now, We have to set a new password for the root user using the below command.

mysql> update user set password=PASSWORD(“NEW_PASSWORD_HERE”) where User=’root’;


We have to execute the flush privileges command to update the changes to take effect.

mysql>flush privileges

Now exit from the mysql shell and restart mysql service Once and then try to login with your new mysql password.

#service mysqld restart


Now, You can be able to login to mysql with your new custom password.

No comments:

Post a Comment

TicTic v2.2 - Android media app for creating and sharing short videos

Facebook Twitter Tiktik – Android app for creating and sharing short videos. The customizable social video application to build ...

Popular Posts