To Reset any Mysql Database you need to perform following operations
- Stop the MySQL server
- Locate my.cnf and add following line to [mysqld] block
skip-grant-tables = 1
- Start mysql server and login using following command
mysql
- Change password for root user
UPDATE mysql.user SET Password=PASSWORD('abc123') WHERE User='root';
or
UPDATE mysql.user SET authentication_string=PASSWORD('q1w2e3r4') WHERE User='root';
then issue
FLUSH PRIVILEGES;
- Restart Mysql after removing skip-grant-tables variable from my.cnf
Note: skip-grant-tables enables anyone to connect without a password and with all privileges, and disables account-management statements such as ALTER USER and SET PASSWORD, Because this is insecure. if the server is started with the –skip-grant-tables option, it enables –skip-networking automatically to prevent remote connections.