Reset MariaDB 10.5 root password on Windows 10

This is my frequent problem actually, after doing it so many times in win 7, now it’s time to do it on Windows 10 (finally my OS get upgraded). So let’s get started

  • Stopping mariaDB service by opening run(window + R) , and typing services.msc
  • On list, double click MariaDB. Once the detail window shows, make sure to check the installation path of MariaDB
  • Create a text file containing the password-assignment statement on a single line. Replace the password with the password that you want to use

SET PASSWORD FOR ‘root’@’localhost’ = PASSWORD(‘YourNewPassword!’);
FLUSH PRIVILEGES;

  • Save the file. This example assumes that you name the fileĀ C:\mysql-init.txt.
  • Open console window as administrator by accessing start > type cmd > choose run as administrator
  • run mysqld with init configuration (mysql path can be seen on service properties on the previous step)
  • After in run, you may see the process listed in task manager. It alredy execute the query to reset the password, we can stop the service
  • Go to run > services.msc again, and start the service
  • Voila, you can login with the new password on your mariaDB client

References:
MySQL documentation
Stackoverflow
Programmersought blog