日期:2014-05-16  浏览次数:20696 次

MYSQL 删除主键出现错误!
 
mysql> select * from a;
+----+------+----------+
| id | name | password |
+----+------+----------+
| 1 | a | NULL |
| 2 | a | NULL |
| 3 | a | NULL |
| 4 | a | NULL |
+----+------+----------+
4 rows in set (0.00 sec)

mysql> alter table a drop primary key(id);
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 '(id)'
 at line 1
mysql>


什么原因啊????


------解决方案--------------------
alter table a drop primary key;

就行了,为什么要画蛇添足地加上个 (id) 呢?

参考一下官方手册中的语法说明。
MySQL官方文档 http://dev.mysql.com/doc/refman/5.1/zh/index.html