簡體   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