# Foreign key and table lost after mysqld crash

**URL:** <https://forums.percona.com/t/foreign-key-and-table-lost-after-mysqld-crash/4452>\
**Category:** Other MySQL® Questions\
**Created:** [October 14, 2015, 11:08am UTC](https://forums.percona.com/t/foreign-key-and-table-lost-after-mysqld-crash/4452 "2015-10-14T11:08:13Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![OlivierD](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/olivierd/32/1093_2.png) [@OlivierD](https://forums.percona.com/u/OlivierD)\
**Post date:** [October 14, 2015, 11:08am UTC](https://forums.percona.com/t/foreign-key-and-table-lost-after-mysqld-crash/4452/1 "2015-10-14T11:08:13Z")

</div>

Hello,

I have some trouble with a created table that disappeared and cannot be created again…

Let me explain :

I’ve created table ‘phone\_contacts’, perform some ALTER TABLE on it (add colums). Then, I tried adding a foreign key on it (referencing an existing table). At this point, MySQL server crashed (sorry, no log at that point …)

When it came back online, my table was missing.

Running CREATE TABLE failed with error -1.

On disk, I only found the .ibd file, the .frm was missing. I then created a duplicate table phone\_contacts2, copied phone\_contacts2.frm to phone\_contacts.frm : table appeared again.  
I issued a DROP TABLE phone\_contact (to try to cleanup innodb dictionary), query failed but table was dropped …

Now, instead of having an error -1 when issuing CREATE TABLE, I have error 150 : this is because the foreign key is still out there, blocking the creation …

Now :

- I have no phone\_contacts table
- no phone\_contacts.\* file on disk.
- when trying to create table :  
ERROR 1005 (HY000): Can’t create table ‘xxxx.phone\_contacts’ (errno: 150)

Syslog :  
InnoDB: Error: in ALTER TABLE `xxxx`.`phone_contacts`  
InnoDB: has or is referenced in foreign key constraints  
InnoDB: which are not compatible with the new table definition.

So, it seems my foreign key constraint is still written somewhere, but I don’t know how to drop it.  
There is no reference on it on INFORMATION\_SCHEMA.TABLE\_CONSTRAINTS, so do not know where else to check.

I’m using Percona Server 5.5.39
