MYSQL OVERVIEW
To get started, read the mysql manual: https://dev.mysql.com/doc/refman/5.7/en/resetting-permissions.html.
The steps will show you how to turn off the service and start it with an overridden command that does not require passwords, then you will reset the password. From the manual:
Stop the MySQL server, then restart it with the --skip-grant-tables option. This allows any user to connect without a password and with all privileges and disables account management operators such as ALTER USER and SET PASSWORD . Since this is unsafe, you can use --skip-grant-tables in combination with --skip-networking to prevent remote clients from connecting.
Connect to the MySQL server using the mysql client; no password is required because the server was started with --skip-grant-tables :
shell> mysql
In the mysql client, tell the server to reload the grant tables so that the account management statements work:
mysql> FLUSH PRIVILEGES;
Then change the password of the account 'root'@'localhost' . Replace the password with the password you want to use. To change the password for the root account with a different part of the host name, change the instructions to use this host name.
MySQL 5.7.6 and later:
mysql> ALTER USER 'root'@'localhost' IDENTIFIED BY 'MyNewPass';
MySQL 5.7.5 and earlier:
mysql> SET PASSWORD FOR 'root'@'localhost' = PASSWORD('MyNewPass');
Or directly on the user table:
UPDATE mysql.user SET password=PASSWORD('mynewpassword') WHERE user='root';
XAMPP SPECIAL
Stop the MySQL service. Open a command window. Go to the MySQL XAMPP directory:
> cd \xampp\mysql\bin\
Start the service without protection (note that you are using mysqld, not mysql):
> mysqld.exe --skip-grant-tables
The MySQL service will work in this window, so open another command window and switch to the MySQL XAMPP directory:
> cd \xampp\mysql\bin\
Launch the MySQL client:
> mysql
Update Password:
mysql> UPDATE mysql.user SET password=PASSWORD('mynewpassword') WHERE user='root';
Exiting MySQL:
mysql> \q
Use the task manager to undo mysqld.exe, which still works. Restart the MySQL service.