#1025 - Error on rename of table errno: 150 : Table was deleted while tried to assign foreign key
You have a weird situation, but it has happened others.

Some worked around this


(Bug?) InnoDB MySQL error 1025, errno 150 Foreign Key
What does mysql error 1025 (HY000): Error on rename of './foo' (errorno: 150) mean?


Others have tried to explain it


MySQL's ERROR 1025 explained
SQLSTATE[HY000]: General error: 1025 Error on rename of


I think the problem stems from the InnoDB Architecture (Vadim Tkachencko's Picture)



See the data dictionary at the top of ibdata1 ? Although the physical file (table1.ibd) to the InnoDB table is gone, the data dictionary still thinks the table exists.

I have addressed this data dictionary issue before


Jul 03, 2014 : Can&#39;t create table, but table doesn&#39;t exist
Jun 09, 2014 : temp table (#sql-7a87_230c32.ibd along with its .frm) still exists on slave


You may need to mysqldump the database and load it into a new server (as suggested by the OP since it was unresolved but worked around), or look for a tool that can flush out the bad data dictionary entry.