繁体   English   中英

这种MySQL语法有什么问题?

[英]What is wrong in this MySQL syntax?

怎么了

我从本地pma导出了该表,并尝试将其上载到远程服务器。

CREATE TABLE IF NOT EXISTS `posts` (
  `id` bigint(20) NOT NULL AUTO_INCREMENT,
  `date` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `banna` text COLLATE utf8_croatian_ci,
  `bannb` text COLLATE utf8_croatian_ci,
  `img` varchar(255) COLLATE utf8_croatian_ci DEFAULT NULL,
  `images` text COLLATE utf8_croatian_ci,
  `title` varchar(255) COLLATE utf8_croatian_ci DEFAULT NULL,
  `subtitle` varchar(255) COLLATE utf8_croatian_ci DEFAULT NULL,
  `story` mediumtext COLLATE utf8_croatian_ci,
  `status` varchar(255) COLLATE utf8_croatian_ci DEFAULT NULL,
  `tags` varchar(255) COLLATE utf8_croatian_ci DEFAULT NULL,
  `auth` varchar(255) COLLATE utf8_croatian_ci DEFAULT NULL,
  `moder` varchar(255) COLLATE utf8_croatian_ci DEFAULT NULL,
  `linked` json DEFAULT NULL,
  `inde` int(11) DEFAULT NULL,
  `count` int(11) DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=382 DEFAULT CHARSET=utf8 COLLATE=utf8_croatian_ci

错误:

#1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'json DEFAULT NULL,
  `inde` int(11) DEFAULT NULL,
  `count` int(11) DEFAULT NULL' at line 15

我已经在mysql版本5.7.21上运行了您的查询,它工作正常,没有引发错误,所以在我看来,您站点中出现的mysql版本相关问题,这是执行结果

CREATE TABLE IF NOT EXISTS `posts` (
  `id`       bigint(20) NOT NULL                   AUTO_INCREMENT,
  `date`     datetime   NOT NULL                   DEFAULT CURRENT_TIMESTAMP,
  `banna`    text COLLATE utf8_croatian_ci,
  `bannb`    text COLLATE utf8_croatian_ci,
  `img`      varchar(255) COLLATE utf8_croatian_ci DEFAULT NULL,
  `images`   text COLLATE utf8_croatian_ci,
  `title`    varchar(255) COLLATE utf8_croatian_ci DEFAULT NULL,
  `subtitle` varchar(255) COLLATE utf8_croatian_ci DEFAULT NULL,
  `story`    mediumtext COLLATE utf8_croatian_ci,
  `status`   varchar(255) COLLATE utf8_croatian_ci DEFAULT NULL,
  `tags`     varchar(255) COLLATE utf8_croatian_ci DEFAULT NULL,
  `auth`     varchar(255) COLLATE utf8_croatian_ci DEFAULT NULL,
  `moder`    varchar(255) COLLATE utf8_croatian_ci DEFAULT NULL,
  `linked`   json                                  DEFAULT NULL,
  `inde`     int(11)                               DEFAULT NULL,
  `count`    int(11)                               DEFAULT NULL,
  PRIMARY KEY (`id`)
)
  ENGINE = InnoDB
  AUTO_INCREMENT = 382
  DEFAULT CHARSET = utf8
  COLLATE = utf8_croatian_ci

0行受影响1.535秒

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM