MySQL 错误 #1064

发布于 2024-10-18 22:36:57 字数 177 浏览 7 评论 0原文

好的。我几乎阅读了所有内容,但找不到问题的答案。我不明白出了什么问题。它一直给我#1064 - 你的 SQL 语法有错误;检查与您的 MySQL 服务器版本相对应的手册,了解在第 2 行 ')' 附近使用的正确语法

CREATE TABLE users (
);

Okay. I have read through almost everything, except I cannot find the answer to my problem. I don't get what's wrong.. It keeps giving me #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 2

CREATE TABLE users (
);

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

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

发布评论

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

评论(5

情绪少女 2024-10-25 22:36:57

您尚未在表中定义任何列。

You haven't defined any columns in your table.

羁拥 2024-10-25 22:36:57

我刚刚经历过,在创建表查询中,当您提到主键时,您不会收到错误。否则您会收到错误。这是一次奇怪的经历。我们尝试一下

CREATE TABLE User
(
    id INT NOT NULL AUTO_INCREMENT, 
    PRIMARY KEY(id)
)

您必须提供至少一列。这将是你的主钥匙。

I have just experienced that in create table query when you mention primary key then you don't get an error. Otherwise you are receiving error. This is a strange experience. well try this

CREATE TABLE User
(
    id INT NOT NULL AUTO_INCREMENT, 
    PRIMARY KEY(id)
)

You must provide at least one column. And that would be your primary key.

老旧海报 2024-10-25 22:36:57

还需要定义一个引擎吗?

create table users (
    user_id tinyint unsigned primary key auto_increment,
    [.....]
)engine=innodb;

You also need to define a engine?

create table users (
    user_id tinyint unsigned primary key auto_increment,
    [.....]
)engine=innodb;
权谋诡计 2024-10-25 22:36:57

第二个错误 1113 是否回答了您的问题?

mysql> create table users();
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 1

mysql> create table users;
ERROR 1113 (42000): A table must have at least 1 column

更多详细信息可以在这里找到 http://dev.mysql.com /doc/refman/5.1/en/create-table.html

Does the second error 1113 answer your query?

mysql> create table users();
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 1

mysql> create table users;
ERROR 1113 (42000): A table must have at least 1 column

Further details can be found here http://dev.mysql.com/doc/refman/5.1/en/create-table.html

山色无中 2024-10-25 22:36:57

另一种可能是您没有选择数据库:

mysql> create table t(id int);
ERROR 1046 (3D000): No database selected
mysql> show warnings;
+-------+------+----------------------+
| Level | Code | Message              |
+-------+------+----------------------+
| Error | 1046 | No database selected |
+-------+------+----------------------+
1 row in set (0.00 sec)

Another possible is that you did't choice database:

mysql> create table t(id int);
ERROR 1046 (3D000): No database selected
mysql> show warnings;
+-------+------+----------------------+
| Level | Code | Message              |
+-------+------+----------------------+
| Error | 1046 | No database selected |
+-------+------+----------------------+
1 row in set (0.00 sec)
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文