Reset mysql database root password

November 24, 2008
  1. stop mysql server
  2. $ /etc/init.d/mysql stop

    if it doesn’t work then kill the process

    $ ps aux | grep mysql

    now you got the mysql pid, then kill it

    $ kill -9 <pid>

  3. run mysql server safe mode with option –skip-grant-tables
  4. $ /usr/bin/safe_mysqld --skip-grant-tables

  5. login to your mysql server using user root
  6. $ /usr/bin/mysql -u root

  7. change the root password
  8. mysql> UPDATE user SET Password=PASSWORD('YOUR_PASSWORD') WHERE Host='localhost' AND User='root';

  9. restart mysql server
  10. $ /etc/init.d/mysql restart


Follow

Get every new post delivered to your Inbox.