MySQL corrupts after every server restart

与世无争的帅哥 提交于 2020-04-07 08:40:06

问题


I Have a bit of an odd problem. I am running MySQL and Drupal site from a windows environment (not by choice but it is just how things have worked out) and most of the time the site is fine however every time the server is restarted (from updates or for maintenance) The MySQL Database will corrupt.

When I log in to MySQL Work bench I notice that the server status is stopped and when I try to start it I get the error:

ERROR Fatal error: Can't open and lock privilege tables: Can't find file: 'user' (errno: 2 - No such file or directory)

and then MySQL Server fails to restart.

The only way around this problem is to delete data folder in the ProgramData/MySQL and then replace it with a backup from a fresh install of MySQL then import a backup of my tables and recreate my users.

My Question is what is causing MySQL to corrupt at every sever restart and what can I do to prevent this happening moving forward?


回答1:


This occurs when mysql can not find or do not have permissions to user.MYD or user.MYI or user.frm in the data directory. When you start mysql, make sure that these files exist in data directory. You can just copy those files when mysql does not start




回答2:


This worked for me: Stick with the 32 bit.

Uninstall and make sure you then DELETE the mysql-data folder and all its subfolders before installing, and prefer to use the 32 bit (sometimes 64 bit versions are the problem).

(Source)



来源:https://stackoverflow.com/questions/31962024/mysql-corrupts-after-every-server-restart

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!