Fixing the MySQL server not starting in XAMPP is done by reverting back the data files pre-issue. Navigate to your XAMPP MySQL directory ( C:\xampp\mysql ). Create a new folder called FIX_BACKUP . Copy C:\xampp\mysql\backup and C:\xampp\mysql\data into C:\xampp\mysql\FIX_BACKUP .
Apart from corrupted files, improper database shut down, missing files and port changes can also cause this error. When you run MySQL in a webserver, the corrupted files in the mysql/data folder cause MySQL to shut down.
STOP! Please do NOT delete
ibdata1
file!
Deleting this file is like playing a Russian roulette with your databases, it could work and restablish everything, but also, probably could leave unusable every database you have.
Instead, first try using the MySQL backup folder which is included with XAMPP. So do the next:
mysql/data
to mysql/data_old
(you can use any name)mysql/data
mysql/backup
to the new mysql/data
foldermysql/data_old
to mysql/data
(skipping the mysql
, performance_schema
, and phpmyadmin
folders from data_old
)ibdata1
file from mysql/data_old
and replace it inside mysql/data
folderAnd, voilà!
IMPORTANT Deleting this file may render any existing MySQL data unusable. Use with caution
Hey I just did this and it worked:
C:\xampp\mysql\data
directoryibdata1
fileIt should work
If the answers mentioned above are not working, you can try deleting all the files in data, except for the folder
Goto: C:\xampp\mysql\data
After that: Goto: C:\xampp\mysql\bin
then open with notepad my.ini , Its look like this.
Then delete or put into comment the port 3306 and change it to 8111 then run xamp with administrator and its work well.
It should fix it.
Just follow two steps
go to xampp\mysql\backup copy everything from backup folder
go to xampp\mysql\data paste everything in data folder copied from backup folder
Thats all.
Also follow the video description to fix without losing any data:
https://www.youtube.com/watch?v=hB1wshpP3Jc
When you're not running XAMPP as an administrator, shutting down MySQL frequently causes corruption which means you have to repair or delete your tables. To avoid this you need to either run XAMPP as an administrator, or use the proper command prompt method for shutting down MySQL.
You can delete ibdata1
as Kratos suggests, but this can leave you with a broken database as other pieces of your database are still in the /mysql/data/
folder. In my case, this residual data stopped me successfully installing WordPress.
A cleaner way of undoing the damage is to revert your whole /mysql/data/
folder. Windows has built-in folder versioning — right click on /mysql/data/
and select Restore previous versions
. You can then delete the current contents of the folder and replace it with the older version's contents.
Addendum: To ensure that you don't forget to run XAMPP as an administrator you can right click the XAMPP shortcut, go to Properties
, then Advanced
, and finally tick Run as administrator
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With