Recover MySQL Root Password in XAMPP

MySQL

I posted this on StackOverflow and was told to come here.

I have an XAMPP MySQL installation and want to recover the root password. I am aware that questions have asked this already, however they are Linux methods of doing it (I'm on Windows) and I can't seem to figure out what exactly the Linux commands translate to in XAMPP – I tried looking for a place to configure the arguments to not use network etc but couldn't. This is a localhost installation.

Best Answer

This resetroot.bat method did not work for me, even after following the instructions above.

My XAMPP uses this DB version:

  • Server: MariaDB
  • Server version: 10.0.17-MariaDB mariadb.org binary distribution

However, using this answer, I was able to do it manually.

  • Go to your **xampp\mysql\bin** folder
  • Edit my.ini and insert skip-grant-tables below [mysqld]
  • Restart MySQL
  • Set new password for your root user by running UPDATE mysql.user SET Password=PASSWORD('new_password') WHERE User='root' in phpMyAdmin in the mysql database (or just leave it like this if MySQL cannot be accessed from remote hosts)
  • Remove the skip-grant-tables in the my.ini file