How to easily repair, restore or reset MariaDB/MySQL service to the default state in Windows

Step 1. Run Cmd in Windows, make sure that your command prompt is started with the ‘Run as Administrator‘ option.

Step 2. Stop and delete the old MariaDB service (If the old name is MariaDB)

net stop "MariaDB"
sc delete "MariaDB"

Step 3. Repair MariaDB/MySQL service (If the installation path of MaridDB is C:\Program Files\MariaDB 10.6\)

"C:\Program Files\MariaDB 10.6\bin\mysqld.exe" --install MariaDB "--defaults-file=C:\Program Files\MariaDB 10.6\data\my.ini"

Step 4. Start the MariaDB service.

net start "MariaDB"