i'm trying to create some tables in my db but my phpmyadmin is displying the error 1005 - Can't create table, on table tbapp\_por\_tbpais, below is mysql, cam someone help me ? 

Table `tbApp`

```
CREATE TABLE IF NOT EXISTS `tbApp` (
  `app_cod` INT NOT NULL,
  `app_nome` VARCHAR(45) NULL,
  `app_cod_do_app` VARCHAR(45) NULL,
  `app_pac_fit_qtde` VARCHAR(10) NULL,
  `app_pac_flex_qtde` VARCHAR(45) NULL,
  `app_pac_mega_qtde` VARCHAR(45) NULL,
  `app_trial` VARCHAR(1) NULL,
  `app_trial_dias` VARCHAR(4) NULL,
  `app_pac_fit_preco` VARCHAR(45) NULL,
  `app_pac_flex_preco` VARCHAR(45) NULL,
  `app_pac_mega_preço` VARCHAR(45) NULL,
  PRIMARY KEY (`app_cod`))
ENGINE = InnoDB;

```

Table `cupomDesc`

```
CREATE TABLE IF NOT EXISTS `cupomDesc` (
  `cupom_cod` INT NOT NULL,
  `cupom_cod_desc` VARCHAR(45) NULL,
  `cupom_valido_ate` DATETIME NULL,
  `cupom_exp_percent` VARCHAR(45) NULL,
  PRIMARY KEY (`cupom_cod`))
ENGINE = InnoDB;

```

Table `tela`

```
CREATE TABLE IF NOT EXISTS `tela` (
  `tela_cod` INT NOT NULL,
  `tela_nome` VARCHAR(45) NULL,
  PRIMARY KEY (`tela_cod`))
ENGINE = InnoDB;

```

Table `tbHelptips`

```
CREATE TABLE IF NOT EXISTS `tbHelptips` (
  `help_cod` INT NOT NULL,
  `help_texto` VARCHAR(45) NULL,
  `tela_tela_cod` INT NOT NULL,
  PRIMARY KEY (`help_cod`),
  INDEX `fk_tbHelptips_tela1_idx` (`tela_tela_cod` ASC),
  CONSTRAINT `fk_tbHelptips_tela1`
    FOREIGN KEY (`tela_tela_cod`)
    REFERENCES `tela` (`tela_cod`)
    ON DELETE NO ACTION
    ON UPDATE NO ACTION)
ENGINE = InnoDB;

```

Table `tbApp_por_tbPais`

```
CREATE TABLE IF NOT EXISTS `tbApp_por_tbPais` (
  `tbApp_app_cod` INT NOT NULL,
  `tbPais_id` INT(11) NOT NULL,
  PRIMARY KEY (`tbApp_app_cod`, `tbPais_id`),
  INDEX `fk_tbApp_has_tbPais_tbPais1_idx` (`tbPais_id` ASC),
  INDEX `fk_tbApp_has_tbPais_tbApp1_idx` (`tbApp_app_cod` ASC),
  CONSTRAINT `fk_tbApp_has_tbPais_tbApp1`
    FOREIGN KEY (`tbApp_app_cod`)
    REFERENCES `tbApp` (`app_cod`)
    ON DELETE NO ACTION
    ON UPDATE NO ACTION,
  CONSTRAINT `fk_tbApp_has_tbPais_tbPais1`
    FOREIGN KEY (`tbPais_id`)
    REFERENCES `tbPais` (`id`)
    ON DELETE NO ACTION
    ON UPDATE NO ACTION)
ENGINE = InnoDB;

```

Table `tbRevenda_has_tbApp`

```
CREATE TABLE IF NOT EXISTS `tbRevenda_has_tbApp` (
  `tbRevenda_id` INT(11) NOT NULL,
  `tbApp_app_cod` INT NOT NULL,
  `tbApp_Qtde` VARCHAR(45) NULL,
  PRIMARY KEY (`tbRevenda_id`, `tbApp_app_cod`),
  INDEX `fk_tbRevenda_has_tbApp_tbApp1_idx` (`tbApp_app_cod` ASC),
  INDEX `fk_tbRevenda_has_tbApp_tbRevenda1_idx` (`tbRevenda_id` ASC),
  CONSTRAINT `fk_tbRevenda_has_tbApp_tbRevenda1`
    FOREIGN KEY (`tbRevenda_id`)
    REFERENCES `tbRevenda` (`id`)
    ON DELETE NO ACTION
    ON UPDATE NO ACTION,
  CONSTRAINT `fk_tbRevenda_has_tbApp_tbApp1`
    FOREIGN KEY (`tbApp_app_cod`)
    REFERENCES `tbApp` (`app_cod`)
    ON DELETE NO ACTION
    ON UPDATE NO ACTION)
ENGINE = InnoDB;

```

Table `mvx_serial`

```
CREATE TABLE IF NOT EXISTS `mvx_serial` (
  `mvx_cod` INT NOT NULL,
  `mvx_num_serial` VARCHAR(45) NULL,
  `tbPais_id` INT(11) NOT NULL,
  PRIMARY KEY (`mvx_cod`),
  INDEX `fk_mvx_serial_tbPais1_idx` (`tbPais_id` ASC),
  CONSTRAINT `fk_mvx_serial_tbPais1`
    FOREIGN KEY (`tbPais_id`)
    REFERENCES `tbPais` (`id`)
    ON DELETE NO ACTION
    ON UPDATE NO ACTION)
ENGINE = InnoDB;

```

Table `cambio`

```
CREATE TABLE IF NOT EXISTS `cambio` (
  `combio_cod` INT NOT NULL,
  `cambio_valor` VARCHAR(45) NULL,
  PRIMARY KEY (`combio_cod`))
ENGINE = InnoDB;

```

Table `historico`

```
CREATE TABLE IF NOT EXISTS `historico` (
  `hist_cod` INT NOT NULL,
  `hist_geracao_dt_ativacao` VARCHAR(45) NULL,
  `hist_metodo_de_download` VARCHAR(45) NULL,
  `hist_licencas_qtde` VARCHAR(45) NULL,
  `hist_ip` VARCHAR(45) NULL,
  `hist_alias` VARCHAR(45) NULL,
  `tbApp_app_cod` INT NOT NULL,
  `cupomDesc_cupom_cod` INT NULL,
  `mvx_serial_mvx_cod` INT NOT NULL,
  `tbRevenda_id` INT(11) NOT NULL,
  PRIMARY KEY (`hist_cod`),
  INDEX `fk_historico_tbApp1_idx` (`tbApp_app_cod` ASC),
  INDEX `fk_historico_cupomDesc1_idx` (`cupomDesc_cupom_cod` ASC),
  INDEX `fk_historico_mvx_serial1_idx` (`mvx_serial_mvx_cod` ASC),
  INDEX `fk_historico_tbRevenda1_idx` (`tbRevenda_id` ASC),
  CONSTRAINT `fk_historico_tbApp1`
    FOREIGN KEY (`tbApp_app_cod`)
    REFERENCES `tbApp` (`app_cod`)
    ON DELETE NO ACTION
    ON UPDATE NO ACTION,
  CONSTRAINT `fk_historico_cupomDesc1`
    FOREIGN KEY (`cupomDesc_cupom_cod`)
    REFERENCES `cupomDesc` (`cupom_cod`)
    ON DELETE NO ACTION
    ON UPDATE NO ACTION,
  CONSTRAINT `fk_historico_mvx_serial1`
    FOREIGN KEY (`mvx_serial_mvx_cod`)
    REFERENCES `mvx_serial` (`mvx_cod`)
    ON DELETE NO ACTION
    ON UPDATE NO ACTION,
  CONSTRAINT `fk_historico_tbRevenda1`
    FOREIGN KEY (`tbRevenda_id`)
    REFERENCES `tbRevenda` (`id`)
    ON DELETE NO ACTION
    ON UPDATE NO ACTION)
ENGINE = InnoDB;

```