Resetting MySQL Root Password with XAMPP on Localhost

To reset the root password for MySQL on XAMPP, you can follow these steps:

  1. Stop the MySQL service in XAMPP.
  2. Open a command prompt and navigate to the folder where XAMPP is installed (e.g., C:\xampp\mysql\bin).
  3. Run the following command: mysqld --skip-grant-tables
  4. Open another command prompt and navigate to the same folder as above.
  5. Run the following command to log in to MySQL as the root user: mysql -u root
  6. At the MySQL prompt, run the following command to reset the root password:
UPDATE mysql.user SET Password=PASSWORD('your_new_password') WHERE User='root';
FLUSH PRIVILEGES;

Watch a course Learn object oriented PHP

  1. Replace "your_new_password" with the password that you want to use for the root user.
  2. Quit the MySQL prompt by running the following command: quit
  3. Stop the MySQL server by pressing Ctrl + C in the command prompt where you started it with the --skip-grant-tables option.
  4. Start the MySQL service in XAMPP.

You should now be able to log in to the MySQL server using the new root password.