SQL Error (1005): Can't create table (errno: 1) Operation not permitted

SQL Error (1005): Can't create table (errno: 1) Operation not permitted

下午好,我很确定我在这里遗漏了一些东西,但我不确定是什么,我的目的是为日志创建一个存档 table,按周分区以便我可以删除分区以后。

我已经看到这是可能的: http://dev.mysql.com/doc/refman/5.1/en/partitioning-management-range-list.html 我 运行 进行了相同的测试并且一切正常,但是当我尝试创建以下内容时 table:

CREATE TABLE `tbDatabaseErrors` (
    `idError` INT(6) NOT NULL AUTO_INCREMENT,
    `database` VARCHAR(50) NULL DEFAULT NULL,
    `table` VARCHAR(50) NULL DEFAULT NULL,
    `errorMessage` VARCHAR(150) NULL DEFAULT NULL,
    `severity` TINYINT(4) NULL DEFAULT NULL,
    `DateTimeCreated` DATETIME NOT NULL,
    `WeekCreated` TINYINT(2) NOT NULL,
    PRIMARY KEY (`idError`, `WeekCreated`)
)
COLLATE='latin1_swedish_ci'
ENGINE=ARCHIVE
PARTITION BY RANGE(WeekCreated) (
    PARTITION p0 VALUES LESS THAN (4),
    PARTITION p1 VALUES LESS THAN (8),
    PARTITION p2 VALUES LESS THAN (12),
    PARTITION p3 VALUES LESS THAN (16),
    PARTITION p4 VALUES LESS THAN (20),
    PARTITION p5 VALUES LESS THAN (24),
    PARTITION p6 VALUES LESS THAN (28),
    PARTITION p7 VALUES LESS THAN (32),
    PARTITION p8 VALUES LESS THAN (36),
    PARTITION p9 VALUES LESS THAN (40),
    PARTITION p10 VALUES LESS THAN (44),
    PARTITION p11 VALUES LESS THAN (48),
    PARTITION p12 VALUES LESS THAN (53)
);

我不断得到:

SQL Error (1005): Can't create table 'support.tbDatabaseErrors' (errno: 1)
Operation not permitted

有没有人可以帮助我调试并了解这里出了什么问题?

Archive Engine 有很多限制,它不支持替换、更新和删除,其次它不接受多列主键或复合键。您需要将单列作为主键或唯一键。这对你的情况没有帮助。

https://dev.mysql.com/doc/refman/5.0/en/archive-storage-engine.html

 CREATE TABLE `tbDatabaseErrors` (
     `idError` INT(6) NOT NULL AUTO_INCREMENT,
     `database` VARCHAR(50) DEFAULT NULL,
     `table` VARCHAR(50) DEFAULT NULL,
     `errorMessage` VARCHAR(150) DEFAULT NULL,
     `severity` INT(4) DEFAULT NULL,
     `DateTimeCreated` DATETIME DEFAULT current_timestamp,
     `WeekCreated` INT(2) NOT NULL,
  PRIMARY KEY(`idError`)
 )
 ENGINE=ARCHIVE
 COLLATE latin1_swedish_ci;
OK, 0 rows affected (0.01 sec)

错误:

 mysql> CREATE TABLE `tbDatabaseErrors` (
        ->     `idError` INT(6) NOT NULL AUTO_INCREMENT,
        ->     `database` VARCHAR(50) DEFAULT NULL,
        ->     `table` VARCHAR(50) DEFAULT NULL,
        ->     `errorMessage` VARCHAR(150) DEFAULT NULL,
        ->     `severity` INT(4) DEFAULT NULL,
        ->     `DateTimeCreated` DATETIME DEFAULT current_timestamp,
        ->     `WeekCreated` INT(2) NOT NULL,
        ->     PRIMARY KEY (`idError`, `WeekCreated`)
        -> )
        -> ENGINE=ARCHIVE
        -> COLLATE latin1_swedish_ci;

ERROR 1030 (HY000): Got error -1 from storage engine

同样,您不能在非主列上添加分区,这显然会导致错误。请尝试使用其他支持删除和更新操作的引擎。