« Installing 3ware gdm3 for a 9650SE-8LPML on FedoraHow to install BeyondCompare on Fedora 14 64-bit »

How to recover your lost MySQL root password

16/06/11

Permalink 07:59:00 pm, by richard Email , 177 words   English (GB)
Categories: Systems Administration, Mysql

How to recover your lost MySQL root password

Ack, I guess you are reading this because you have a bad memory :-)

Stop MySQL service/deamon

sudo service mysql stop

start the safe MySQL daemon without reading the grant tables I.e No passwords are checked.

sudo mysqld_safe --skip-grant-tables &

Login to MySQL as root, no need for a password here

mysql -u root mysql

UPDATE the root password with the following two commands enter one and press return and then enter the second one.

UPDATE user SET password=PASSWORD("bigsecret") WHERE user="root";
FLUSH PRIVILEGES;

Stop MySQL safe daemon you started as you are still running without passwords.:>

sudo service stop mysqld

restart MySQL daemon as you would normally

sudo service mysqld start

Just to make sure its all done, login to mysql as root. What was it you were going to do with mysql before you realised you didn't know the password?

mysql -u root -p mysql

If all went well you now have the root password for your mysql server reset. (write on a post it and stick it under your keyboard, only joking!! :D )

No feedback yet

Here are a collection of Mini-HOWTOs some of which are too short even for that grand title. I keep them around as it is easier to remember where to look these up that to remember the content of the mini-HOWTO

Search

Contents

blog engine