Reset MySQL Root Password in CentOS

Buy 1 Month, Get 2 Months Free. Coupon: 2MOFREE

“Senior moments” tends to occur more frequently these days. Sign that I’m getting old. And several times already, I forgot the root password of my MySQL installation.

You can recover MySQL database server password with following five easy steps.

Step # 1: Stop the MySQL server process.

# /etc/init.d/mysqld stop

Step # 2: Start the MySQL (mysqld) server/daemon process with the –skip-grant-tables option so that it will not prompt for password.

# mysqld_safe --skip-grant-tables &

Step # 3: Connect to mysql server as the root user.
# mysql -u root
Step # 4: Setup new mysql root account password.

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

Step # 5: Exit and restart the MySQL server.
# /etc/init.d/mysqld stop

Step # 6: Start MySQL server and test it
# /etc/init.d/mysqld start
# mysql -u root -p

The steps are basically the same when resetting the password in other linux flavors. I’m using the same steps in Ubuntu but with a slight difference in shell commands.

reference :
http://dev.mysql.com/doc/refman/5.0/en/resetting-permissions.html

Incoming search terms:

  • reset mysql root password centos
  • centos mysql password
  • reset mysql password centos
  • centos reset mysql root password
  • how to change mysql password in centos
  • how to recover mysql root password centos
  • how to reset mysql root password in centos
  • mysql lost root password
  • mysql forgot root centos
  • set root password centos mysql

No related posts.

Comments

  1. Eli says:

    thank you sir, I followed about 8 tutorials and none worked so i this was the last one I’m going to try, if that didn’t work i was going to reinstall the OS, but it did work lol!!!

    but this didn’t work for me

    /etc/init.d/mysql start

    this worked for me :D

    /etc/init.d/mysqld start

Speak Your Mind

*