0

I have a server on Azure with a MySQL database, we have two apps there and sometimes we get this error on the code:

Warning: mysqli::query(): (HY000/1194): 
Table 'noticia' is marked as crashed and should be repaired 
in D:\home\site\wwwroot\classes\ConnectionFactory.php on line 122

Some questions:

  1. What kind of things could cause this error?
  2. Where can I find the logs in order to get the cause of the error?
  3. Could this be could a PHP problem?

This is too strange because I have been using the same ConnectionFactory class to connect to the database for several year and this is the first time that we get this error.

John K. N.
  • 18,854
  • 14
  • 56
  • 117

1 Answers1

0

I assume this is a MyISAM table. These are not crash safe. InnoDB tables on the other hand, are.

  1. There could be several reasons, such as:

    • disk failure
    • VM reboot or crash
    • mysql daemon crash - open MyISAM tables are likely to crash if the mysql daemon crashes

    See also: Why do MySQL tables crash? How do I prevent it?

  2. The MySQL error log is by default located in the datadir. By default, the file name is the name of the host with the suffix '.err'.

  3. I don't think so, not unless PHP managed to crash the mysql daemon.

You may be able to repair the table by issuing a mysql command like:

REPAIR TABLE your_database_name.noticia;

Or, from the command shell, you can run something like this to check and repair all tables:

mysqlcheck -u root -p --auto-repair --check --all-databases
dbdemon
  • 6,964
  • 4
  • 21
  • 40