Once in awhile I recieve a mistake saying among my tables "is marked as crashed and really should be fixed". Then i perform a REPAIR TABLE and do the repair. What can cause these to be marked as crashed and just how can one prevent it? I'm using MyISAM tables with MySQL 5..45.

There might be a couple of reasons tables get corrupted, it's talked about at length within the manual.

To combat it, these things perform best:

  1. Make certain you usually MySQL shutdown correctly
  2. Think about using --myisam-recover choice to instantly check/repair your tables when shutdown wasn't done correctly
  3. Make certain you are well on the newest versions as known corruption bugs are usually fixed As soon as possible
  4. Make sure your hardware having a test to ascertain if it's leading to problems. Tools like sysbench and memtest86 can frequently help verify if situations are being employed as they ought to.
  5. Make certain there is nothing touching the information directory externally, for example virus checkers, backup programs, etc...

Usually, it takes place once the database isn't shut lower correctly, just like a system crash, or hardware problem.

I did previously get errors from mysql exactly like you.

I solved my problems in by doing this 1) Become all myisam tables to InnoDB (searching "myisam versus InnoDB" in stackoverflow.com and search engines like google to discover why) 2) To get best performance from MySQL, make use of a third-party program MONyog (MySQL Monitor and Consultant) and appearance performance tips

Both of these steps saved me. I really hope these also assist you to lot.

It may be a lot of things, but MySQL Performance Blog mentions bad memory, OS or MySQL bugs that may cause hidden corruption. Also, might another article mention a number of things to bear in mind when you are performing crash recovery.