MySql Password Reset

As I tend to run lots of virtual machines (Virtualbox) for the various CMS I work with (Drupal and Joomla! being the main) I have a bad tendency to forget the root password (not only for MySQL but also for the various applications I’m running). Even though I have a certain way of generating strong passwords sometimes I forget which personnal algorithm I used.

As this is my note pad, and I know you can simply yahoo it and find various solutions to the problem, this blog is my one stop shop.

  1. Step 1: shut down mysqld deamon (on arch cli) :- rc.d stop mysql
  2. Step 2: restart mysqld :- mysqld_safe –skip-grant-tables &
  3. Step 3: login to mysql :- mysql -u root -p
  4. Step 4: update the user table :- UPDATE user SET Password=PASSWORD(‘newpassd’) WHERE User=’root’;
  5. Step 5: Flush DB priviledges :- FLUSH privileges;
  6. Step 6: Exit MySql : quit;
  7. Step 7: Restart mysqld : rc.d restart mysql

The password is reset.



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 )

Google photo

You are commenting using your Google 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 )

Connecting to %s