但我使用NetBeans,然后我可以创建表用户。
答案 0 :(得分:4)
用户是关键字。如果你想用作Tablename,你必须把它放在像。
这样的反引号中CREATE TABLE `user` ( ....
<强>样品强>
mysql> CREATE TABLE `user` (
-> `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
-> `userName` varchar(32) DEFAULT NULL,
-> `password` varchar(32) DEFAULT NULL,
-> `realName` varchar(32) DEFAULT NULL,
-> PRIMARY KEY (`id`)
-> ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
Query OK, 0 rows affected (0,02 sec)
mysql> insert into `user` (id) VALUE (99);
Query OK, 1 row affected (0,00 sec)
mysql> select * from `user`;
+----+----------+----------+----------+
| id | userName | password | realName |
+----+----------+----------+----------+
| 99 | NULL | NULL | NULL |
+----+----------+----------+----------+
1 row in set (0,00 sec)
mysql>