MySQL – Retrieve username & password

  • Stop the MySQL process.
  • Start the MySQL process with the –skip-grant-tables option.
  • Start the MySQL console client with the -u root option.
  • SELECT * FROM mysql.user;
  • UPDATE mysql.user SET Password=PASSWORD('[password]') WHERE User='[username]';

But DO NOT FORGET to

  • Stop the MySQL process
  • Start the MySQL Process normally (i.e. without the –skip-grant-tables option)

when you are finished. Otherwise, your database’s security could be compromised.

Reference :
Stackoverflow
TechRepublic
Digitalocean

Leave a Reply

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