Recently I set up GitHub sponsors, if my content helps you, you can consider a one-time or monthly sponsorship.

Showing full MySQL foreign key errors

This is where the ad would go. Instead though, I'd like to point you towards my GitHub Sponsors page. If you're a regular reader and my content is helping you, you can consider a one-time or monthly sponsorship. If you're a company looking for dedicated ad placements on this blog or my newsletter, you can email me at brendt@stitcher.io

In case of a foreign key error when creating or altering a table, MySQL doesn't show the full message.

You can read the full message by executing the following query and inspecting the Status column.

show engine innodb status;
------------------------
LATEST FOREIGN KEY ERROR
------------------------
2018-02-13 11:12:26 0x70000b776000 Error in foreign key constraint of table table/#sql-7fa_247a:
 foreign key (`my_foreing_key`) references `table` (`id`)
   on delete cascade:
Cannot resolve table name close to:
 (`id`)
   on delete cascade