Recover Mysql Root Password

Just a little linklog to a relevant page on How to Forge. Root privileges are needed.

  1. Stop service: service mysql stop

  2. Start MySQL server w/o password: mysqld_safe --skip-grant-tables &

  3. Connect to CLI client as root: mysql -u root

  4. Reset root password. Here’s the syntax for ≥v.5.7.6.

    mysql> use mysql;
    mysql> SET PASSWORD FOR 'root'@'localhost' = PASSWORD("newpass");
    mysql> flush privileges;
    mysql> quit
    
  5. Repeat step 1, or killall mysqld if it doesn’t work. Output can be different on different Linux distro.

    service mysql start
    mysql -u root -p
    

In step 2, the ampersand & on the right allows the task to be executed in background.

MySQL 

No comment

Your email address will not be published. Required fields are marked *.