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.

  • Does this work? learntech.imsu.ox.ac.uk/blog/?p=151 Aug 26, 2014 at 20:31
  • @James it did, thanks a load! It was a little outdated in that it said line 18 but the file now actually has only 15 lines (it was on line 8) but the end result was the same. Aug 26, 2014 at 22:11
  • Glad to hear it. I think you could document the steps that worked for you and then self-answer if you want. Aug 27, 2014 at 5:08

2 Answers 2


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

Turns out I can now answer this question myself, thanks to the help of @James in the comments. The article here was helpful, but not 100% accurate anymore, so here is how to do it for anyone in the future:

  1. Navigate to the mysql folder (C:/xampp/mysql in my case).
  2. Open resetroot.bat in a text editor.
  3. Look for line 8 (the article above specifies line 18 - the file is only 15 lines long now)
  4. Add –datadir=c:/xampp/mysql/data into the mysql\bin\mysqld.exe line after –no-defaults
  5. Run resetroot.bat and you're done :)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.