Tag Archives: root password

Reset MySQL Root Password Easily

Background:
Sometimes a system administrator forgets the MySQL root password! It happens, but what to do when you’re unable to login to your MySQL server? It’s simple!

All it takes is 5 simple steps!

Step 1: Stop the MySQL Server

We do this with:
/etc/init.d/mysql stop or service mysql stop

Step 2: Start the MySQL Server

mysqld_safe –skip-grant-tables &

We do this so MySQL ignores the root password we do not have! If you do not launch this command, resetting the MySQL password will not work!

Step 3: Login to MySQL Server

mysql -u root

Everything should be fine if you get the MySQL prompt!

Step 4: Change the MySQL Password

mysql> use mysql;
mysql> update user set password=PASSWORD("NEW-ROOT-PASSWORD") where User='root';
mysql> flush privileges;
mysql> quit

NEW-ROOT-PASSWORD is your new root password that you want!

Step 5: Restart MySQL Server

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

Now, you should have your new MySQL root password! I recommend you write it down this time!