1050: Table already exists
MySQLWhat does it mean?
The table being created already exists. CREATE TABLE failed because a table with the same name is present.
Why does it happen?
Re-creating an existing table; a script run twice; migrations applied again; another object (a view) using the same name.
How to fix it
Use IF NOT EXISTS to create the table only if it is absent: CREATE TABLE IF NOT EXISTS my_table (...); If you really want to re-create it, drop it first: DROP TABLE IF EXISTS my_table; List existing tables: SHOW TABLES; Make migrations safe to re-run (idempotent).
More from this engine
- 1292Incorrect datetime value / truncated incorrect value
- 1406Data too long for column
- 1071Specified key was too long; max key length is 767 bytes
- 1051Unknown table 'x'
- 1091Can't DROP 'x'; check that column/key exists
- 1093You can't specify target table 'x' for update in FROM clause
- 1305PROCEDURE does not exist