logo

Main Menu
Home
Products
Tips n Tricks
Download
Contacts
About
Login Form





Lost Password?
Recover Lost Mysql Password PDF Print E-mail
So you've lost the root user password for mysql. here's how you can reset it when looged onto the console as root.

1. Stop mysql

service mysqld stop

2. Restart MySQL in safe mode:

/usr/bin/safe_mysqld --skip-grant-tables&

(Note the above works in mysql 3, for mysql 4 it changed slightly, see below)

/usr/bin/mysqld_safe --skip-grant-tables&


3. Connect to the Mysql server

/usr/bin/mysql

4. Use the mysql database:

> use mysql;

5. Run the update command (replace "<newpassword>" with your new password. Note it is enclose by ' inside the brackets)

> update user set password = password('<newpasswordinhere>') where user = 'root' and host='localhost';

6. Flush the privileges so everything will take:

> flush privileges;

7. Then quit mysql:

> quit

8. Stop mysql from command line with:

service mysqld stop

9. Restart mysql from command line with:

service mysqld start

 
 
logo