无法创建表 - 错误 1064 (42000):您的 SQL 语法有错误

发布于 2024-08-31 07:02:04 字数 260 浏览 10 评论 0原文

我正在尝试执行这个简单的命令:

create table foo
(clo int primary key unsigned auto_increment);

但我收到此错误:

错误 1064 (42000):您遇到错误 在你的 SQL 语法中;检查手册 对应于您的 MySQL 服务器 正确使用语法的版本 靠近“无符号自动增量)” 第 2 行

I'm trying to execute this simple command:

create table foo
(clo int primary key unsigned auto_increment);

But I get this error:

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 'unsigned auto_increment)' at
line 2

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

生来就爱笑 2024-09-07 07:02:04

我尝试将 intunsigned 放在一起,效果很好:

create table foo
(clo int unsigned primary key auto_increment );

I tried putting int and unsigned together and it worked fine:

create table foo
(clo int unsigned primary key auto_increment );
苦妄 2024-09-07 07:02:04

你的语法有点不对劲。试试这个:

create table `foo` (
  `clo` int unsigned auto_increment ,
  PRIMARY KEY(`clo`)
) ENGINE=MYISAM AUTO_INCREMENT=1 DEFAULT CHARSET=utf8;

Your syntax is a little off. Try this:

create table `foo` (
  `clo` int unsigned auto_increment ,
  PRIMARY KEY(`clo`)
) ENGINE=MYISAM AUTO_INCREMENT=1 DEFAULT CHARSET=utf8;
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文