MySQL reset root user password.

If you ever lost the root password for the MySQL root user do not fret as all is not lost. If you have control of the server running MySQL, ssh to it and try the following steps:

  1. Stop the MySQL server process.
  2. Start again in MySQLd_safe with no grant tables.
  3. Login to MySQL as root.
  4. Set new password.
  5. Exit MySQL and restart MySQL server.

# /etc/init.d/mysql stop
# mysqld_safe –skip-grant-tables &
# mysql -u root
mysql> use mysql;
mysql> update user set password=PASSWORD(“newrootpassword”) where User=’root’;
mysql> flush privileges;
mysql> quit
# /etc/init.d/mysql stop
# /etc/init.d/mysql start

This information was taken from here. It has a lot more MySQL commands.


Thinking about someting? Leave a Reply...

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s