如何修复 MySQL 数据库错误 #1064?
数据库错误 #1064 可能由语法不正确引起。例如,假设我们要创建以下表 -
mysql> create table DemoTable ( UserId int NOT NULL AUTO_INCREMENT PRIMARY KEY, UserName varchar(100), UserAge int, UserAddress varchar(200), UserCountryName varchar(100) , isMarried boolean, );
它将产生以下输出,即错误 -
ERROR 1064 (42000): 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 ')' at line 10
要摆脱上述错误,您需要去掉最后一个逗号 (,)。要消除错误,该查询如下 -
mysql> create table DemoTable ( UserId int NOT NULL AUTO_INCREMENT PRIMARY KEY, UserName varchar(100), UserAge int, UserAddress varchar(200), UserCountryName varchar(100), isMarried boolean ); Query OK, 0 rows affected (1.04 sec)
广告