我正在尝试将mysql workbench 8.0.3与mariadb一起使用,但出现以下错误:
Executing:
CREATE TABLE `mydb`.`customer` (
`ID` INT UNIQUE UNSIGNED NOT NULL AUTO_INCREMENT,
`Name` VARCHAR(255) NOT NULL,
`Email` VARCHAR(255) CHARACTER SET 'utf8' NOT NULL,
`Street` VARCHAR(255) CHARACTER SET 'utf8' COLLATE 'utf8_czech_ci' NOT NULL,
`City` VARCHAR(255) CHARACTER SET 'utf8' COLLATE 'utf8_czech_ci' NOT NULL,
PRIMARY KEY (`ID`));
ERROR 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 'UNSIGNED NOT NULL AUTO_INCREMENT,
`Name` VARCHAR(255) NOT NULL,
`Email` VARC' at line 2
SQL Statement:
CREATE TABLE `mydb`.`customer` (
`ID` INT UNIQUE UNSIGNED NOT NULL AUTO_INCREMENT,
`Name` VARCHAR(255) NOT NULL,
`Email` VARCHAR(255) CHARACTER SET 'utf8' NOT NULL,
`Street` VARCHAR(255) CHARACTER SET 'utf8' COLLATE 'utf8_czech_ci' NOT NULL,
`City` VARCHAR(255) CHARACTER SET 'utf8' COLLATE 'utf8_czech_ci' NOT NULL,
PRIMARY KEY (`ID`))
Operation failed: There was an error while applying the SQL script to the database.
上面看到的代码是使用“createtable”工作台特性生成的。
2条答案
按热度按时间egmofgnx1#
UNSIGNED
以及INT
一起走,这样就行了:这个比较短:
主键已为非-
NULL
以及unique
. 不需要两次声明这些属性。gg0vcinb2#
我用int(10)代替int来解决这个问题
不