Thursday, October 3, 2013

How to Reset MySQL Password

If you need to reset your mysql password because you forgot it or any other reason the guide below will help you to reset root password. Just follow this procedure. 

Stop mysqld 
  • /etc/init.d/mysqld stop 
Start mysql with options below 
  • mysqld_safe --skip-grant-tables & 
Connect to Mysql 
  • mysql -u root 
  • Select the database 
    • mysql> use mysql; 
  • Update the password 
    • mysql> update user set password=PASSWORD("newrootpassword") where User='root'; 
  • Flush privliges 
    • mysql> flush privileges; 
  • Exit  
    • mysql> quit 
      
  • Restart mysql 
    • /etc/init.d/mysqld stop 
    • /etc/init.d/mysqld start  

Test connection by running 
  • mysql -u root -p 

No comments:

Post a Comment