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

来源:-

慕瓜1576617

2018-12-02 09:26

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

写回答 关注

0回答

还没有人回答问题,可以看看其他问题

Restful API实战

PHP后端开发者如何迎上移动互联网发展热潮?

44002 学习 · 118 问题

查看课程

相似问题