Reset MySql Root password in Linux

Reset MySql Root password in Linux.
  Use the following steps to reset a MySQL root password by using the command line(Terminal).

Linux Debian & Rpm Package Support
Step 1:
          Debian:
sudo /etc/init.d/mysql stop
         Rpm: 
sudo /etc/init.d/mysqld stop
Step 2:
         Start MySQL without a password      
sudo mysqld_safe --skip-grant-tables &
Step 3:
         Connect to MySQL     
mysql -u root
Step 4:
          Run the Command:  
use mysql;
update user set password=PASSWORD("mynewpassword") where User='root';
flush privileges;
quit

Step 5:
          Start and Stop Mysql Service
          Debian:
sudo /etc/init.d/mysql stop
sudo /etc/init.d/mysql start
         Rpm:
sudo /etc/init.d/mysqld stop
sudo /etc/init.d/mysqld start
Step 6:
          Login Mysql database Using root Password..
   mysql -u root -p

Post a Comment

0 Comments