问答详情
源自:-

到达建表那一块,用mysql bench 建的两张表,在navicate报错打不开,请问老师或同学们如何处理?

USE `mydb` ;

-- -----------------------------------------------------

-- Table `mydb`.`user`

-- -----------------------------------------------------

DROP TABLE IF EXISTS `mydb`.`user` ;


CREATE TABLE IF NOT EXISTS `mydb`.`user` (

  `user_id` INT NOT NULL AUTO_INCREMENT,

  `username` VARCHAR(20) NOT NULL,

  `password` CHAR(32) NOT NULL,

  `create_at` DATETIME NOT NULL,

  PRIMARY KEY (`user_id`),

  INDEX `username` (`username` ASC) VISIBLE,

  INDEX `create_at` (`create_at` ASC) VISIBLE)

ENGINE = InnoDB

DEFAULT CHARACTER SET = utf8;

-- -----------------------------------------------------

-- Table `mydb`.`article`

-- -----------------------------------------------------

DROP TABLE IF EXISTS `mydb`.`article` ;


CREATE TABLE IF NOT EXISTS `mydb`.`article` (

  `article_id` INT NOT NULL,

  `title` VARCHAR(40) NOT NULL,

  `content` TEXT NOT NULL,

  `user_id` INT NOT NULL,

  PRIMARY KEY (`article_id`),

  INDEX `fk_article_user_idx` (`user_id` ASC) VISIBLE,

  CONSTRAINT `fk_article_user`

    FOREIGN KEY (`user_id`)

    REFERENCES `mydb`.`user` (`user_id`)

    ON DELETE NO ACTION

    ON UPDATE NO ACTION)

ENGINE = InnoDB

DEFAULT CHARACTER SET = utf8;


SET SQL_MODE=@OLD_SQL_MODE;

SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS;

SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS;

[SQL] Finished successfully with error

提问者:慕瓜1576617 2018-12-02 09:26

个回答