Thursday, September 25, 2008

How to reset a Forgotton Password in MYSQL

ever forgotton your root password for your mysql database, or any other users password for that matter, no problem here
simply stop mysql by typing
/etc/init.d/mysqld stop

then restart Mysql with the following command

mysqld_safe --skip-grant-tables

You should see mysqld start up successfully. Now you should be able to connect to mysql without a password.

mysql --user=root mysql

update user set Password=PASSWORD('new-password');
flush privileges;
exit;

once done restart mysql normally

/etc/init.d/mysqld restart

Shaaawiiing

No comments: