1

can anyone help me out to fix this error in mysql. My SQL is script is given below.

    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 script execution finished: statements: 13 succeeded, 1 failed

Fetching back view definitions in final form. Nothing to fetch

cwallenpoole
  • 79,954
  • 26
  • 128
  • 166
C0deSlayer
  • 45
  • 9
  • Or you're trying to add a constraint to a table that doesn't exist yet (or doesn't exist in schema defined...) does customer, state, domain names subdomains, domain name log, subdomains log all exist with the keys defined? – xQbert May 02 '17 at 15:28
  • It's already exist in the schema. – C0deSlayer May 02 '17 at 15:34

0 Answers0