我在 docker 容器中有一个 MySQL 数据库。入口点执行创建数据库的脚本和创建表的脚本。
除了一张桌子,一切都很好。
use db;
... creating other tables
CREATE TABLE mediametadata
(
id bigint not null primary key,
title VARCHAR not NULL,
artist VARCHAR not NULL,
album VARCHAR,
releaseYear bigint,
mediaId bigint NOT NULL,
constraint fk__pk_metadata_objectid
foreign key (id) references objectid (id),
constraint fk__metadata_media_id
foreign key (mediaId) references media (id)
)
;
记录到控制台的错误是
mysql_1 | ERROR 1064 (42000) at line 150: 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 'not NULL,
mysql_1 | artist VARCHAR not NULL,
mysql_1 | album VARCHAR,
mysql_1 | releaseYear bigint,
mysql_1 | mediaId bi' at line 4
第 150 行是后面的左括号CREATE TABLE mediametadata
- MySQL 版本:8.0.3-rc-log
- 主机操作系统:Debian jessie
我开始思考year
,metadata
可能是保留关键字,所以我重命名了表和year
列,但错误仍然存在。