具体错误信息如下:
mysql> desc people; +----------+--------------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | +----------+--------------+------+-----+---------+-------+ | id | int(11) | YES | | NULL | | | name | varchar(50) | YES | | NULL | | | location | varchar(400) | YES | | NULL | | +----------+--------------+------+-----+---------+-------+ 3 rows in set (0.01 sec) mysql> mysql> insert into people values(1,'red queen','umbraller'); ERROR 3098 (HY000): Unknown error 3098 mysql>
出现该错误的原因是,目标数据表没有主键列。
添加主键列,就可以解决问题:
mysql> alter table people add primary key(id); Query OK, 0 rows affected (0.04 sec) mysql> insert into people values(1,"red queen","umbraller"); Query OK, 1 row affected (0.01 sec) mysql> select * from people; +----+-----------+-----------+ | id | name | location | +----+-----------+-----------+ | 1 | red queen | umbraller | +----+-----------+-----------+ 1 row in set (0.00 sec) mysql>
——————————
Done。