修复MySQL错误1064(42000),请检查与您的MySQL服务器版本相对应的手册,以获取在')'附近使用的正确语法
如果您使用了不正确的语法,则可能会发生此错误。假设以下是createtable语句-
mysql> create table DemoTable1492 -> ( -> timestamp TIMESTAMP, -> event int, -> ); 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 5
您需要在事件列之后删除上面的多余逗号以进行修复。让我们首先创建一个-
mysql> create table DemoTable1492 -> ( -> timestamp TIMESTAMP, -> event int -> );
使用insert在表中插入一些记录-
mysql> insert into DemoTable1492 values(now(),101); mysql> insert into DemoTable1492 values(now()+interval 3 month,102);
使用选择命令显示表中的所有记录-
mysql> select * from DemoTable1492;
这将产生以下输出-
+---------------------+-------+ | timestamp | event | +---------------------+-------+ | 2019-10-06 10:56:53 | 101 | | 2020-01-06 10:57:07 | 102 | +---------------------+-------+ 2 rows in set (0.00 sec)