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 (password: jangkrik)
    # mysql -u root -p
  7. If all working as intended, Then shutdown MySQL
    # mysqladmin shutdown -p
  8. Start MySQL daemon normally
    # service mysql start

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s