The error generated in phpMyAdmin is:
This table does not contain a unique column. Grid edit, checkbox, Edit, Copy and Delete features are not available.
What does this error message mean and how can I fix it?
If there are no unique columns or primary keys, functions such as edit, copy, delete, etc. are prohibited for performance and security reasons, as it can not be guaranteed that there are no multiple entries that can subsequently lead to problems.
Click on the table you wish to modify. Inside the table, you will see a list of columns. To the right of the column name, you will see a link called "Change" under the Actions. Click on the Change link for the column you wish to modify.
Adding a Primary Key to a New Table In phpMyAdmin. When creating a new table in phpMyAdmin, select PRIMARY from the Index dropdown on the column that will be the primary key. Check the box in the A_I column if this will be an auto incrementing key.
After you selected your database & table on the left side, you need to Browse that table (marked yellow). Then you can edit or delete rows. It is even possible to double click a value in a cell to directly edit it (newer versions).
I have been faced with this problem.
The cause is your table doesn't have a primary key field.
And I have a simple solution: Set a field to primary key to specific field that suits your business logic.
For example, I have database thesis_db
and field thesis_id
, I will press button Primary (key icon) to set thesis_id
to become primary key field:
This is not an error. PhpMyAdmin is just informing you, that there is no unique ID column in your result set. Depending on the type of query you sent, this is the desired behaviour.
It is not MySQL which is saying it needs a unique ID, if any combination of the columns in your result set is unique, the values of those columns can be used in an UPDATE or DELETE query. It is phpMyAdmin which says it does not have enough information to offer you the checkboxes and buttons you will normally see in a result set with unique ID.
Simply create a new column, set the Name
to whatever you like, set the Type
to INT
and check the box that says A_I
.
The A_I
checkbox stands for AUTO_INCREMENT
, which essentially means that sequence numbers are assigned automatically in that new column (see below).
column1 | column2 | id
-----------------------
value | value | 1
-----------------------
value | value | 2
-----------------------
value | value | 3
-----------------------
value | value | 4
This column essentially acts as a reference for phpMyAdmin to delete rows from. If necessary, click on the unique button for this new column, although this happened automatically for me. After following the above steps, you should no longer have the error message and buttons should appear for editing rows in phpMyAdmin!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With