Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I get an error when I try to create a table:

ERROR 1005 (HY000): Can't create table 'phact_greenland.cache' (errno: 121)

    `cid` varchar(255) NOT NULL DEFAULT '' 
        COMMENT 'Primary Key: Unique cache ID.'
    , `data` longblob 
        COMMENT 'A collection of data to cache.' 
    , `expire` int(11) NOT NULL DEFAULT '0' 
        COMMENT 'A Unix timestamp indicating when the cache entry 
                should expire, or 0 for never.'  
    , `created` int(11) NOT NULL DEFAULT '0' 
        COMMENT 'A Unix timestamp indicating when the cache entry was created.'  
    , `serialized` smallint(6) NOT NULL DEFAULT '0' 
        COMMENT 'A flag to indicate whether content is serialized (1) or not (0).' 
    , PRIMARY KEY (`cid`) 
    , KEY `expire` (`expire`)
    COMMENT='Generic cache table for caching things not separated out...';

How do i solve it ?

share|improve this question
Try it again, then run SHOW engine innodb STATUS; and edit your question with the end of the output. – Phil Sep 12 '12 at 12:20
up vote 3 down vote accepted

You get Error 121 when you try to create a table that contains a constraint with the same name as a constraint defined elsewhere in your database. You can avoid this issue by naming the constraints yourself in the creation script. More information can be found below:

InnoDb Error Codes

Create Table Statement

I hope this helps you.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.