Thursday, March 26, 2015

Reset MySQL root password



In some circumstances you need to reset MySQL root without knowing current password of it. For example you forget the password. You can change the password of the root user easily. The following guide is tested on Ubuntu 12.04 based on MySQL 5.5.

Reset root password (without knowing the current password)

To do so, please follow the instructions below:

Step 1: Stop the MySQL Service

At first, you need to stop the MySQL service:
$ sudo /etc/init.d/mysql stop

Step 2: Start the MySQL daemon in safe mode with skipping grants

Please run the MySQL in safe mode with skipping grants parameter:
$ sudo mysqld_safe --skip-grant-tables &

Step 3: run the MySQL prompt as root user without password

Now, you can enter the MySQL command line as root user without password:
$ mysql -u root

Step 4: Update the password of root user

Run the following commands to update root user password. Please replace "NEW-ROOT-PASSWORD" with the desired password:
mysql> use mysql;
mysql> update user set password=PASSWORD("NEW-ROOT-PASSWORD") where User='root';
mysql> flush privileges;
mysql> quit

Step 5: Restart the MySQL service

You should restart the MySQL service to check the new password:
$ sudo /etc/init.d/mysql stop
$ sudo /etc/init.d/mysql start

Step 6: Login with the new password

Now, login to the MySQL prompt with the new password:
$ mysql -u root -p


  1. Useful Information……
    Recruitment voice contains Daily GK Updates, Bank Recruitment, Government jobs, Bank jobs, Interview Tips, Banking News, GK Updates Bank Recruitment

  2. Nice Information:
    Telugu Cinema Contains Telugu Cinema News, Latest Movie Reviews, Actor, Actress, Movie Galleries And Many More Telugu Cinema News

  3. Helpful Information Provides Latest Telugu Movie Reviews , Telugu Political News and Other Latest Telugu Movie News

  4. Helpful Information:

    Telugu Cinema Contains Telugu Cinema News, Telugu Movie Reviews and many more @

  5. Nice information for job seekers. Thanks for sharing the awesome information , i also recommend online Notification

  6. Very Good Information and i also recommend Freshers job way ; as they are leading sites provides job information

  7. Thanks , you are giving very important information for many job seekers. In my experience , i got job through Recruitment Voice and according to me it is also one of the best site.

  8. Nice Information
    one and only A Digital Marketing Agency in INDIA affiliate network in india