Thursday, May 21, 2015

Reset MySQL root Password In Ubuntu

                                  In Linux distributions you can recover the mysql root password using the following steps
  1. Stop all the MySQL processes
service mysql stop
     2.   Start MySQL server with –skip-grant-tables enabled
This option will let you login as root without any password
mysqld_safe --skip-grant-tables &
     3.   Connect to the MySQL server from your shell
mysql -u root
Eg :- root@ubuntu:~# mysql -u root
                     mysql>
      4.  Setup a new MySQL root password
use mysql;
            update user set password=PASSWORD("New Password") where User='root';
            flush privileges;
            exit
Eg :-    mysql -u root
mysql> update user set password=PASSWORD('amma') where user='root';
Query OK, 4 rows affected (0.02 sec)
Rows matched: 4  Changed: 4  Warnings: 0
      5.  Start all the MySQL processes
                       service mysql start
      6.  Test your new MySQL root password
mysql -u root -p

No comments:

Post a Comment

bloggerwidgets