[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [cobalt-users] Lost root passwdord for MySQL



S.K.Sirajuddin wrote:


> Can any one tell me how i can reset my MySQL root passowrd which i forgot,

1. Shutdown or kill MySQL.
2. From the linux prompt type "mysqld --safemode -Sg &" to start MySQL
bypassing the grant tables.
3. Type "mysql -u root".
4. mysql> use mysql; [opens mysql db]
5. mysql> delete from user where User='root' [deletes user "root" from User
table]
6. mysql> show fields from "user"; and count the # of fields that take a
value of "Y" or "N"
7. mysql> insert into user values ("root","mypassword","Y","Y",..,"Y")
[enter "Y" the # of times from above - it is 14 in my version of MySQL]
8. Write your password down somewhere safe or put it in a password protected
file somewhere safe.
9. mysql> flush privileges; [updates MySQL privileges to put new root user
and password into effect]
10. mysql> exit
11. Shutodown or kill MySQL.
12. Restart MySQL by typing "safe_mysqld &" or whatever other method you are
used to.

My instructions are from my notes and recollection of what I did a couple of
weeks ago.  I didn't forget my password, but I wanted to make sure I knew
how to bypass the grant tables in case I needed to.

Steven {steven@xxxxxxxxxxxx}