Saturday, April 12, 2014

MySql Datafiles are getting corrupted on Mac-OSX abrupt shutdown

I have consistently faced this issue of MySql data files getting corrupted when my machine is rebooted abruptly. This has resulted into repetitive work that I have to do to rebuild the data. I tried to google for the solution and see if somebody else has seen this issue. But it seems this the way it will work, as MySql data files are not closed properly which results into corrupt database in case your machine gets abruptly restarted. I got this reference on stackexchange   

To recover corrupted data some times following commands worked well but not always. 

$ sudo mysqladmin refresh
$ sudo mysqladmin flush-tables 
Finally restart your myql server.

So to over come this issue, I stop my MySql service when I am not using it. This is not the perfect solution, as there is a still possibility your machine gets hanged or restarted abruptly while you are working with MySql. But at least it will lower down the possibility of corruption when you are not using it.    


  1. A database ideally should handle loosing cached data on sudden reboots.
    Techniques exits which when implemented will [almost]always keep things consistent(some updates might be missing but you will have a consistent view of data after reboot).

  2. It would be really helpful if you could guide me to use any such technique.