Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Locating Database Errors

If you ever run into:

(1005, 'Can't create table `database_name`.`table_name` (errno: 150 "Foreign key constraint is incorrectly formed")

Run:

mariadb -e "SHOW ENGINE INNODB STATUS"

You're looking for:

------------------------
LATEST FOREIGN KEY ERROR
------------------------
2022-03-11 17:23:05 0x700003f4c000 Error in foreign key constraint of table `database_name`.`table_name`:
Create  table `database_name`.`table_name` with foreign key `fk_really_long_name_here` constraint failed. There is no index in the referenced table where the referenced columns appear as the first columns.
------------
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment