Schrödingers MySQL table: exists, yet it does not

后端 未结 11 1816
野趣味
野趣味 2020-11-29 23:47

I am having the weirdest error of all.

Sometimes, when creating or altering tables, I get the \'table already exists\' error. However, DROP TABLE returns \'#1051 - u

11条回答
  •  有刺的猬
    2020-11-30 00:11

    I've seen this issue when the data file is missing in the data directory but the table definition file exists or vise-versa. If you're using innodb_file_per_table, check the data directory to make sure you have both an .frm file and .ibd file for the table in question. If it's MYISAM, there should be a .frm, .MYI and a .MYD file.

    The problem can usually be resolved by deleting the orphaned file manually.

提交回复
热议问题