mysql从shell客户端创建表语句时出现错误

问题描述 投票:0回答:1

我试图从mysql shell客户端运行下面的内容,并一直得到以下错误:ERROR: 1064: You have error in your SQL syntax; check manual corresponds to your MySQL server version for the right syntax to use near ')'at 1 line:

MySQL  localhost:33060+ ssl  plaything  SQL > CREATE TABLE areas (id SERIAL PRIMARY KEY, area_name VARCHAR);

并一直得到以下错误:ERROR: 1064: 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 1.

我可能在哪里出了问题?

mysql shell
1个回答
0
投票

被yoss解决了。

试试这个: CREATE TABLE areas ( id int NOT NULL AUTO_INCREMENT, area_name varchar(255), PRIMARY KEY (id) )。

varchar没有在原语句中指定的字符数。

© www.soinside.com 2019 - 2024. All rights reserved.