简体   繁体   中英

Mysql: No key names but Can't create table (errno: 121)

Yes, I have read all tpoics about error 121 but I still get

Can't create table 'catalog_category_flat_store_1' (errno: 121)

My query does not contain any CONSTRAINTs or key names

DROP TABLE IF EXISTS `catalog_category_flat_store_1`;
CREATE TABLE `catalog_category_flat_store_1` (
  `entity_id` int(10) NOT NULL,
  PRIMARY KEY (`entity_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

Renaming table does help but is not an option here (Don't like to rewrite Magento)

For SHOW ENGINE INNODB STATUS I don't have the PROCESS privilege.

What is wrong with this query?

The query is valid, so can could be conflicting with another table's constraint name. Try specifying the PK name via CONSTRAINT pk_id PRIMARY KEY ( entity_id )

DROP TABLE IF EXISTS `catalog_category_flat_store_1`;
CREATE TABLE `catalog_category_flat_store_1` (
  `entity_id` int(10) NOT NULL,
  CONSTRAINT `pk_id` PRIMARY KEY (`entity_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

它对我有用,请尝试以管理员权限运行mysql并检查用户数据库是否具有所有权限,例如drop,create等。

Looks like my innoDB is broken. I found my problem and a solution. Not done testing but looks promissing:

https://dba.stackexchange.com/questions/69656/cant-create-table-but-table-doesnt-exist

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM