MYSql错误:错误1022:无法写入;表中的重复键

时间:2017-05-02 15:20:41

标签: mysql

任何人都可以帮我解决mysql中的这个错误。我的SQL是脚本,如下所示。

    Executing SQL script in server
ERROR: Error 1022: Can't write; duplicate key in table 'dns module'
SQL Code:
        -- -----------------------------------------------------
        -- Table `databasee`.`dns module`
        -- -----------------------------------------------------
        CREATE TABLE IF NOT EXISTS `databasee`.`dns module` (
          `dns_id` INT NOT NULL,
          `purchase_date` TIMESTAMP NULL,
          `expiration_date` TIMESTAMP NULL,
          `customer_id` VARCHAR(20) NULL,
          `company_id` INT NULL,
          `state_id` INT NULL,
          `nt_zone_id` INT NULL,
          `nt_zone_record_id` INT NULL,
          `nt_zone_log_id` INT NULL,
          `nt_zone_record_log_id` INT NULL,
          `ttl` DATETIME NULL,
          PRIMARY KEY (`dns_id`),
          INDEX `customer_ID_idx` (`customer_id` ASC),
          INDEX `state_id_idx` (`state_id` ASC),
          INDEX `nt_zone_id_idx` (`nt_zone_id` ASC),
          INDEX `nt_zone_record_id_idx` (`nt_zone_record_id` ASC),
          INDEX `nt_zone_log_id_idx` (`nt_zone_log_id` ASC),
          INDEX `nt_zone_record_log_id_idx` (`nt_zone_record_log_id` ASC),
          CONSTRAINT `customer_id`
            FOREIGN KEY (`customer_id`)
            REFERENCES `databasee`.`customer` (`cust_id`)
            ON DELETE NO ACTION
            ON UPDATE NO ACTION,
          CONSTRAINT `state_id`
            FOREIGN KEY (`state_id`)
            REFERENCES `databasee`.`state` (`state_id`)
            ON DELETE NO ACTION
            ON UPDATE NO ACTION,
          CONSTRAINT `nt_zone_id`
            FOREIGN KEY (`nt_zone_id`)
            REFERENCES `databasee`.`domain names` (`nt_zone_id`)
            ON DELETE NO ACTION
            ON UPDATE NO ACTION,
          CONSTRAINT `nt_zone_record_id`
            FOREIGN KEY (`nt_zone_record_id`)
            REFERENCES `databasee`.`subdomains` (`nt_zone_record_id`)
            ON DELETE NO ACTION
            ON UPDATE NO ACTION,
          CONSTRAINT `nt_zone_log_id`
            FOREIGN KEY (`nt_zone_log_id`)
            REFERENCES `databasee`.`domain name log` (`nt_zone_log_id`)
            ON DELETE NO ACTION
            ON UPDATE NO ACTION,
          CONSTRAINT `nt_zone_record_log_id`
            FOREIGN KEY (`nt_zone_record_log_id`)
            REFERENCES `databasee`.`subdomains log` (`nt_zone_record_log_id`)
            ON DELETE NO ACTION
            ON UPDATE NO ACTION)
        ENGINE = InnoDB

SQL脚本执行完成:语句:13成功,1失败

以最终形式获取视图定义。 没什么可取的

0 个答案:

没有答案