On the Net

|Main Blog|Yearning|  

Words of God

About Linux News and OpenSource

and below are my posts....

Thursday, March 30, 2006

Recovering and Changing Your MySQL Root Password

Sometimes you may have to recover the MySQL root password because it was either forgotten or misplaced. The steps you need are:

1. Stop MySQL: as root

service mysqld stop

2.Start MySQL in Safe mode with the safe_mysqld command and tell it not to read the grant tables with all the MySQL database passwords:

safe_mysqld --skip-grant-tables &
[1] 4815
Starting mysqld daemon with databases from /var/lib/mysql

3.Use the mysqladmin command to reset the root password. In this case, you are setting it to


mysqladmin -u root flush-privileges password "thisisthepassword"

4.Restart MySQL normally:

service mysqld restart
Stopping MySQL: 040517 09:39:38 mysqld ended
[ OK ]
Starting MySQL: [ OK ]
[1]+ Done safe_mysqld --skip-grant-tables

The MySQL root user will now be able to manage MySQL using this new password.


Post a Comment

Links to this post:

Create a Link

<< Home