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
- Check SHOW INDEX FROM table
- Use unique, descriptive index names
- Drop or skip existing indexes
Detailed fix by platform
MySQL
SHOW INDEX FROM orders;
How to diagnose
- Index — Already present?
- 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