Thursday, April 21, 2011

How to Reset "MySql" Root Password (CentOS 5)

Evening all,

Ran into a problem a few weeks ago that I finally set down and solved after visiting a couple of forums. These steps are pieced together from many places. Special thinks to all the forums that helped me reset my database password. *Note* Every thing in blue is what you type. *Where you see "whatever password you want" means just that but keep it inside the parentheses () and quotations.

Stop the MySQL daemon : service mysqld stop
Start MySQL in safe mode with the –skip-grant-tables and -u root options in background : mysqld_safe –skip-grant-tables -u root &
Start the command line client as root : mysql -u root
Issue the MySQL command to reset the root password : UPDATE mysql.user SET Password=PASSWORD(‘whatever password you want’) WHERE User=’root’;
Issue the flush privileges command : FLUSH PRIVILEGES;
Quit the command line tool : quit
Find MySQL Process ID: ps aux | grep mysqld
Stop the MySQL process : kill process id goes here `cat /var/run/mysqld/mysqld.pid`
Restart the MySQL daemon : service mysqld start
Log in as root to make sure the new password is active : mysql -u root -p
Type the new password at the prompt

YOUR IN, DON'T FORGET IT NEXT TIME!!!!!

1 comment:

  1. Thanks been looking for this all over!!!!

    ReplyDelete