开发者

MySQL Error #1064

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 MySQ开发者_如何学JAVAL server version for the right syntax to use near ')' at line 2

CREATE TABLE users (
);


You haven't defined any columns in your table.


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.


You also need to define a engine?

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


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


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)
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜