Resetting MySQL Root Password with XAMPP on Localhost
To reset the root password for MySQL on XAMPP, you can follow these steps.
To reset the root password for MySQL on XAMPP, follow these steps:
- Stop the MySQL service in XAMPP.
- Open a command prompt and navigate to the folder where XAMPP is installed (e.g.,
C:\xampp\mysql\bin). - Run the following command:
mysqld --skip-grant-tables - Open another command prompt and navigate to the same folder as above.
- Run the following command to log in to MySQL as the root user:
mysql -u root - At the MySQL prompt, run the following commands to reset the root password:
FLUSH PRIVILEGES;
ALTER USER 'root'@'localhost' IDENTIFIED BY 'your_new_password';
<div class="alert alert-info flex not-prose">![]()
<span class="hidden md:block">Watch a video course</span>Learn object oriented PHP</div>
- Replace
your_new_passwordwith your desired password. - Exit the MySQL prompt by running:
exit - Stop the MySQL server by pressing
Ctrl + Cin the command prompt where you started it with the--skip-grant-tablesoption. - Start the MySQL service in XAMPP.
You should now be able to log in to the MySQL server using the new root password.
Note: By default, the XAMPP MySQL root account has no password initially.