新版本的 PHPMyAdmin 使我无法编辑数据

2022-01-05 00:00:00 mysql phpmyadmin

PHPMyAdmin 刚刚被我的服务器管理员升级到 v4.0.4.2.

PHPMyAdmin has just been upgraded by my server admin to v4.0.4.2.

现在我无法编辑下表中的行:

Now I am unable to edit rows in the following table:

CREATE TABLE IF NOT EXISTS `product_options` (
  `product_id` int(10) NOT NULL,
  `option_id` int(10) NOT NULL,
  KEY `product_id` (`product_id`,`option_id`)
)

PHPMyAdmin 仅在我浏览表中的数据时返回此错误消息:

PHPMyAdmin just returns this error message when I browse data in the table:

此表不包含唯一列.网格编辑、复选框、编辑、复制和删除功能不可用.

我不想在此表中使用唯一的列,那么如何编辑数据?有我可以更改的设置吗?

I don't want a unique column in this table, so how can I edit data? Is there a setting I can change?

非常感谢

MySQL v5.1.70

MySQL v5.1.70

编辑/解决方案

我意识到它不一定是一个新的 唯一列 PHPMyAdmin 希望我创建,而是一个 唯一索引.这意味着我的表的结构不必更改 - 我只需要添加一个唯一索引,无论如何我应该这样做.

I realised that it wasn't necessarily a new unique column PHPMyAdmin was wanting me to create, but instead a unique index. This means that the structure of my tables didn't have to change - I just had to add a unique index, which I should have been doing anyway.

推荐答案

如果没有唯一键,就无法区分可以存在的两个相同记录.因此 phpMyAdmin 不能安全地编辑表格 - 您不知道哪些最终会被编辑.你真的想在这个表中有重复的记录吗?

Without unique key, there is no way to differentiate between two same records which can exists. Therefore phpMyAdmin can not safely edit the table - you have no clue which of these would end up edited. Do you really want to have duplicate records in this table?

相关文章