Hello.
Here are some instructions to restore your lost super user root.
1. Stop Apache and MySQL by using the Control Panel.
2. Open a plain text editor and add the following 3 lines (nothing else) to the very top of a new page:
- Code: Select all
INSERT INTO mysql.user (Host, User, Password) VALUES('localhost', 'root', PASSWORD(''));
GRANT ALL PRIVILEGES ON *.* TO 'root'@'localhost' WITH GRANT OPTION;
FLUSH TABLES;
It must be exactly as written in the code section above, you may copy and paste if you prefer.
3. Save the file into the
C:\xampp\mysql folder as
undoroot.sql.
(
Change the folder location to where you have your own XAMPP installed if different from the default.).
4. Go back to the Control Panel and click on the
Shell button.
5. At the Shell
# prompt type
- Code: Select all
mysqld --init-file="C:\xampp\mysql\undoroot.sql"
Click on Enter which should then start the MySQL server using the undoroot.sql file and the instruction it contains.
(
Change the folder location from the default to where you have your own XAMPP installed.).
6. Next go to the Control Panel again where you should see that MySQL has started - click on the Stop button so that MySQL is no longer running.
7. Now Start Apache and MySQL, again using the Control Panel and then click on the MySQL Admin button where, if all goes to plan you should have access to phpMyAdmin.
8. Exit/close the shell console window.
Also you should now have access to all your databases that you had previous to accidentally deleting the root user.
Good luck.