Wednesday, July 9, 2008

MySQL Root Password Reset

Ok, I admit I am very forgetful. My wife would even say "very, very forgetful." So, besides not remembering my Joomla password (see related article). I forget other passwords like my database passwords.

For MySQL, my recipe for reseting my password is as follows:

As root,
  • Stop currenly running mysql server
    # service mysqld stop 
  • Restart service manually without using permissions
    # mysqld_safe --skip-grant-tables &
  • Connect to service with mysql as root
    # mysql -u root
  • Use mysql database
  • mysql> use mysql;
  • Reset password field for 'root'
    mysql> update user set password=PASSWORD("your-new-password") where User='root';
  • Make sure everything is pushed to server
    mysql> flush privileges;
  • Quit the MySQL client
    mysql> quit
  • Stop the server which is running without permissions
    # kill -TERM %1
  • Restart the service properly
    # service mysqld restart

1 comments:

Sherry Martschink said...

Jack,
Enjoyed finding your blog, although I don't understand computerese.
Sherry
www.blondesherry.blogspot.com

CrossLoop

About Me

My Photo
Jack Briner
I'm a Texan who is living in South Carolina. I love living in Charleston with its history and proximity to the water. I'm married to a Lutheran pastor. We have two teenagers and two dogs.
View my complete profile

Some of my sites