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