Wednesday, May 24, 2017

Reset MySQL root password in Ubuntu

In this POST I will show how to reset MySQL Server root password in Ubuntu

In the previous posts I had shown how to .....

Use the following steps to reset a MySQL root password by using the command line interface in Linux.
Stop the MySQL service
  

sudo /etc/init.d/mysql stop

Start MySQL without a password
  

sudo mysqld_safe --skip-grant-tables &

Connect to MySQL
  

mysql -uroot

Set a new MySQL root password
  

use mysql;
UPDATE user SET authentication_string=PASSWORD('YOURNEWPASSWORD') WHERE User='root';
flush privileges;
quit;

Stop and start the MySQL service
  

sudo /etc/init.d/mysql stop
sudo /etc/init.d/mysql start

Log in to the database
  

mysql -u root -p

You are prompted for your new password.

No comments:

Post a Comment