Reset the Root user password in MySQL or MariaDB on the Window platform
- Create an empty file with the name change password in C: drive or any other location.
C:\changepassword.txt
2. Edit the file and enter in the later command as follows and save the file:
ALTER USER 'root'@'localhost' IDENTIFIED BY 'NewPassword';
3. Open the services.msc and stop the MySQL service.

4. Right-click on MySQL80 services and get the path from where the service running and its default in the file location
"C:\Program Files\MySQL\MySQL Server 8.0\bin\mysqld.exe" --defaults-file="C:\ProgramData\MySQL\MySQL Server 8.0\my.ini" MySQL80

5. Open the cmd and run the command as follows to change the password:
cd "C:\Program Files\MySQL\MySQL Server 8.0\bin"
mysqld --init-file=C:\\changepassword.txt
6. If you have some default configuration then run as otherwise start the service and try to login with a new password; Start the service that already includes the default file. The following command is not needed to execute:
mysqld.exe --init-file=C:\\mysql-init.txt --defaults-file="C:\ProgramData\MySQL\MySQL Server 8.0\my.ini" MySQL80