1061 🐬 MySQL

MySQL ERROR 1061 (42000): Duplicate key name 'x'

CREATE INDEX/ADD INDEX used an index name that already exists on the table.

Seen on: MySQL

Meaning

Re-run migrations or adding an index that a previous deployment already created.

Common causes

  • Migration run twice
  • Same index name reused

⚡ Quick fix

  1. Check SHOW INDEX FROM table
  2. Use unique, descriptive index names
  3. Drop or skip existing indexes

Detailed fix by platform

MySQL

  1. SHOW INDEX FROM orders;

How to diagnose

  1. Index — Already present?
  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.