3780 🐬 MySQL

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

  1. Make both columns identical (type, length, sign, collation)
  2. 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

  1. ALTER TABLE orders MODIFY user_id BIGINT UNSIGNED NOT NULL;

How to diagnose

  1. Columns — SHOW FULL COLUMNS for both tables
  2. 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.