Xampp MySQL server not starting due to db index corruption

Spread the love

Today I faced the following error while starting MySQL server in Xampp on windows platform.

18:28:15  [mysql] 	This may be due to a blocked port, missing dependencies, 
18:28:15  [mysql] 	improper privileges, a crash, or a shutdown by another method.
18:28:15  [mysql] 	Press the Logs button to view error logs and check
18:28:15  [mysql] 	the Windows Event Viewer for more clues
18:28:15  [mysql] 	If you need more help, copy and post this
18:28:15  [mysql] 	entire log window on the forums

The error log file didn’t had anything useful. So, I have check the windows Event Viewer. It contained all the logs needed.

If you don’t know about Event Viewer app in windows, then search about it. In simple words it contains the events generated by any application. An application has to specifically log the events. The basic troubleshooting starts from event viewer.

So, type ‘Event Viewer’ in the start menu and open the app. Navigate to ‘Event Viewer (Local)’ -> ‘Windows Logs’ -> ‘Application’. Check the errors from ‘mariadb’ source.

My error was:

Can't open and lock privilege tables: Index for table 'db' is corrupt; try to repair it

To fix this, I had to copy ‘C:\xampp\mysql\backup\mysql\db.MAI’ file to ‘C:\xampp\mysql\data\mysql’. Make a backup of old db.MAI first.

After doing it, my MySQL started without any error. In most cases you server will start if any ‘mysql’ db file is corrupted. But there is no guarantee that your data will be intact. So, i just take the backup of all your databases at least on daily basis.

Cheers and Peace out!!!