Hi developers, how are you today? I am glad to share with you ta way that fixes the error that faces most developers on the XAMPP server, and it states "Error: MySQL shutdown unexpectedly. This may be due to a blocked port, missing dependencies, improper privileges, a crash, or a shutdown by another method".
MySQL shutdown unexpectedly Error in XAMPP |
I have faced this problem repeatedly, so you can say that I have become an expert in this problem and you can count on me to solve it and get rid of it and restart your server again with ease.
What is "MySQL shutdown unexpectedly", and why do you get this problem?
I think that every web developer faces a "MySQL shutdown unexpectedly" Error in his life, so if you ask yourself why I get these issues? and what are these issues basically? , I will tell you the answer in the next lines.
What is the "MySQL shutdown unexpectedly" error?
The MySQL error is the unexpected shutdown of the MySQL server located inside the virtual XAMPP server, or sometimes the inability to run the database server in your virtual server.
You will get something like this:
[mysql] Error: MySQL shutdown unexpectedly.
[mysql] This may be due to a blocked port, missing dependencies,
[mysql] improper privileges, a crash, or a shutdown by another method.
[mysql] Press the Logs button to view error logs and check
[mysql] the Windows Event Viewer for more clues
[mysql] If you need more help, copy and post this
[mysql] entire log window on the forums
Why did MySQL shutdown unexpectedly" error happen?.
The "MySQL shutdown unexpectedly" error occurs for many reasons, I will mention to you the most important of them, which are the most common reasons for all users:
- If reinstalled The XAMPP server or updated.
- If the files of MySQL are corrupted or get deleted.
- Improper database shutdown.
- Improper privileges, a crash, or a shutdown by another method.
- Due to a blocked port or missing dependencies.
How to fix the "MySQL shutdown unexpectedly" error
You can fix the problems of the MySQL server by using the easiest way Which is to restore the original files from the backup folder of the MySQL database server and put them back in the data folder, following the method step by step.
Step 1
Go to the path: "C:\xampp\mysql" or when your XAMPP server is installed.
Step 2
Rename the "data" folder to "old-data" or any name you want.
step 3
Make a copy of the "backup" folder and rename it to "data".
step 4
Copy all folders inside the "old-data" folder except for the 3 following folders:
- mysql
- performance_schema
- phpmyadmin
step 5
Past the folders that you copied in the previous step inside the new "data" folder that we created in step 4.
step 6
Copy the file "ibdata1" that exists inside the "old-data" folder and past it inside the new "data" folder.
step 7
Start MySQL server from the XAMPP control panel.
That's all, Now the MySQL server should run fine and without any problem.
Conclusion
That was the best way to fix the "MySQL shutdown unexpectedly" error, If you have any Inquiries please put them in a comment to do what I can to help you.