View Single Post
  #1   IP: 106.110.148.214
Old 2015-12-17, 10:50 PM
Fackler Fackler is offline
初级会员
 
Join Date: 2008-06-21
Posts: 1
Fackler 现在声名狼藉
Default 原因及解决方法:Current selection does not contain a unique column……

我把我本地调试好的 WordPress 上传至阿里云服务器,当我把数据库上传导入到阿里云上的 phpMyAdmin 时,打开一个表,居然有报错信息如下:
Current selection does not contain a unique column. Grid edit, checkbox, Edit, Copy and Delete features are not available.

么情况?本地好好的呀,看了下 phpMyAdmin 版本,本地的要老得多,阿里云上的新不少,应该是这个原因导致的。本来也不去理它的,但是结果发现数据库无法操作了,无法编辑修改数值。这……必须得解决。那么这句话什么意思呢?如何解决?

  其实它的大概意思是:不存在独立项,所以无法编辑、复制、删除数据等操作。原因网上找了下:当一个数据库没有主键,并且你并不想使用自增ID的时候(有时候实际上并无用处,徒徒增加索引大小而已),那么会出现这个情况。

可以增加一个字段, 并设置为主键就可以了:alter table table1 add id int unsigned not Null auto_increment primary key

alter table temp_htaccess add id int unsigned not Null auto_increment primary key
Reply With Quote