SQL:
CREATE TABLE `forum`
(
`id` Int UNSIGNED NOT NULL AUTO_INCREMENT,
`login` Varchar(35) CHARACTER SET utf8mb4 COLLATE utf8mb4_polish_ci NOT NULL,
`password` Varchar() CHARACTER SET utf8mb4 COLLATE utf8mb4_polish_ci NOT NULL,
`register` Datetime(0) NOT NULL,
`last_login` Datetime(0) NOT NULL,
`birth` Date NOT NULL,
`about` Varchar(500),
`sex` Bool,
`group` Smallint UNSIGNED NOT NULL,
`rank` Smallint UNSIGNED NOT NULL,
`avatar` Varbinary(2000) NOT NULL,
`status` Tinyint UNSIGNED NOT NULL DEFAULT 1,
PRIMARY KEY (`id`,`group`,`rank`),
PRIMARY KEY (`id`,`group`,`rank`),
UNIQUE `id` (`id`)
) ENGINE = InnoDB
DEFAULT CHARACTER SET utf8mb4
COLLATE utf8mb4_polish_ci
;
ALTER TABLE `Forum`.`users` ADD UNIQUE `login` (`login`)
;
消息日志:
[Err] 1064 - You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'CREATE TABLE `forum`
(
`id` Int UNSIGNED NOT NULL AUTO_INCREMENT,
`log' at line 1
[Err] CREATE TABLE `forum`
(
`id` Int UNSIGNED NOT NULL AUTO_INCREMENT,
`login` Varchar(35) CHARACTER SET utf8mb4 COLLATE utf8mb4_polish_ci NOT NULL,
`password` Varchar() CHARACTER SET utf8mb4 COLLATE utf8mb4_polish_ci NOT NULL,
`register` Datetime(0) NOT NULL,
`last_login` Datetime(0) NOT NULL,
`birth` Date NOT NULL,
`about` Varchar(500),
`sex` Bool,
`group` Smallint UNSIGNED NOT NULL,
`rank` Smallint UNSIGNED NOT NULL,
`avatar` Varbinary(2000) NOT NULL,
`status` Tinyint UNSIGNED NOT NULL DEFAULT 1,
PRIMARY KEY (`id`,`group`,`rank`),
PRIMARY KEY (`id`,`group`,`rank`),
UNIQUE `id` (`id`)
) ENGINE = InnoDB
DEFAULT CHARACTER SET utf8mb4
COLLATE utf8mb4_polish_ci
;
[Msg] Finished - Unsuccessfully
--------------------------------------------------
我正在看这个并寻找,在网上寻求解决方案,但在这里找不到什么问题。
只是无法执行此sql文件,错误。 UTF-8编码。
使用Toad Data Modeler 6.1试用
创建的SQL文件转储答案 0 :(得分:1)
变化:
...
-- `password` Varchar() CHARACTER SET utf8mb4 COLLATE utf8mb4_polish_ci NOT NULL,
`password` Varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_polish_ci NOT NULL,
...
和
...
-- PRIMARY KEY (`id`,`group`,`rank`),
PRIMARY KEY (`id`,`group`,`rank`),
...