Month: February 2017

How to Reset MySQL >= 5.7.6 Password

Posted on Updated on

  1. Login to the MySQL Server Host.
  2. # service mysql stop
  3. Start MySQL with skip grant table
    # mysqld_safe –skip-grant-tables &
  4. Login to MySQL as root (without password)
    # mysql -u root
  5. Let say we want to reset root password to ‘jangkrik‘, then we do:
    mysql> flush privileges;
    mysql> ALTER USER ‘root’@’localhost’ IDENTIFIED BY ‘jangkrik‘;
    mysql> flush privileges;
    mysql> quit;
  6. Check if the root password is set correctly
    # mysql -u root -p
  7. If all working as intended, Then shutdown MySQL
    # mysqladmin shutdown -p
  8. Start MySQL daemon normally
    # service mysql start
Advertisements