MySQL ERROR 3780 (HY000): Referencing column 'x' and referenced column 'y' in foreign key constraint are incompatible.
MySQL 8 refuses a foreign key between columns of different types or collations.
Seen on:
MySQL
Meaning
The 8.0 version of errno 150 with a clearer message: INT vs BIGINT, UNSIGNED vs signed, or utf8 vs utf8mb4 collations.
Common causes
- Type or sign mismatch
- Collation/charset mismatch for string keys
⚡ Quick fix
- Make both columns identical (type, length, sign, collation)
- Convert the table charset first if collations differ: ALTER TABLE t CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci
Detailed fix by platform
MySQL
ALTER TABLE orders MODIFY user_id BIGINT UNSIGNED NOT NULL;
How to diagnose
- Columns — SHOW FULL COLUMNS for both tables
- Recent change — Did it start after a deploy, upgrade, or configuration change? Compare with the last working version.
🧠 Still stuck? Analyze your error
Paste the full message, response headers or stack trace — we'll detect the platform and point to the most likely cause.
Was this page helpful?
Report a correction or suggest an improvement
Last updated 2 Oct 2026