2

On my server I had files from 2012, 2013, ... 2016 which were .frm, .MYD, .MYI. I deleted files which were older than 180 days. I left the files from this year only.

Three days later database was gone and phpMyAdmin showed:

#2002 - The server is not responding (or the local MySQL server's socket is not correctly configured)

Could deletion of these old MySQL files have been the problem here?

2

Well I guess you just deleted the database's data files (.myd) and the database's index files (.myi) from your database server. To top it off you deleted the *.frm file which are also part of your database.

One reference I came across: Normalize Table File Name Extensions
Another reference describes what you did manually: What happens when you drop your database
The full reference can be found here: MySQL Glossary

I do hope you have a backup of your database?

  • I have backup. But what I don't understand is that in the directory they were same files just different date prefixes and I just deleted oldest one. There are still newest files in the directory. This mean database actually used even files from 2012? – Jason Paddle Oct 31 '16 at 13:52
  • I didn't execute any DROP or whatever sql query... – Jason Paddle Oct 31 '16 at 13:53
  • Yes, I realize that you did not perform a drop statement, but it was manually the equivalent. Well not quite, because you deleted some files that probably were still being used by the database, whereas a drop statement would have correctly deleted the no longer required files. From the glossary for the .frm files: For backups, you must always keep the full set of .frm files along with the backup data to be able to restore tables that are altered or dropped after the backup. – John aka hot2use Oct 31 '16 at 13:58
  • 2
    Well.. i guess lesson learned hard way.. – Jason Paddle Oct 31 '16 at 14:00
1

The .frm files define the tables. They are unlikely to change. So their date could be old, even if the table is actively in use. Do not delete the .frm if you keep the other files with the same base.

All files in the mysql directory are vital to the operation of MySQL, regardless of how old they are. Do not delete any of them.

It is really unwise to do what you did. To save space, you could consider DROP TABLE. But, again, do not drop any tables in the mysql database.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.