Resolution: This table does not contain a unique column. Grid editing, checkbox, editing, copying and deleting are not available

This is not a question, but a self-created problem / question and solution that I found working. I thought it would be a courtesy, because there was no complete working solution that I could find.

Error generated in phpMyAdmin:

"This table does not contain a unique column. Grid editing, checkbox, editing, copying and deleting are not available."

Depending on your exact scenario, there are several working solutions.

For example, if your entire AI or Unique identifier field is unique, you can simply modify the table and make sure that it is the Primary key and set a unique value.

I solved this with this solution on one of my tables.

In another table, there were several AI int values ​​that were a Primary field, but there were several values ​​of the same type.

A simple solution to this was to simply add a column at the end of the table as a unique AI Int. Essentially, all of MySQL says that each row requires a unique value to distinguish between rows.

Hope this was helpful.

+55
database php mysql phpmyadmin
Sep 20 '13 at 17:25
source share
15 answers

I ran into this problem.

The reason is that your table does not have a primary key field .

And I have a simple solution. Set the primary key field for specific applications that match your business logic.

For example, I have the thesis_db database and the thesis_id field, I will click the Primary button (icon icon) to set thesis_id to become the primary key field:

enter image description here

+35
Dec 13 '14 at 4:26
source share

It's not a mistake. PhpMyAdmin simply informs you that there is no unique identifier column in your result set. Depending on the type of request sent, this is the desired behavior.

This is not MySQL that says it needs a unique identifier, if any combination of columns in your result set is unique, the values ​​of these columns can be used in an UPDATE or DELETE query. This is phpMyAdmin, which says that it does not have enough information to offer you the checkboxes and buttons that you usually see in the result set with a unique identifier.

+20
Dec 23 '13 at 14:42
source share

My business is different. This issue is specific to PHPMyAdmin only. I downloaded a couple of other admin tools (Adminer, MySQLWorkbench, HeidiSQL, etc.), and the same db works fine in all of these files.

I have all the indexes, primary key and unique keys defined and still getting the error. I get this after I upgraded to MySQL 5.6 (it didn’t look like previous versions).

It turns out that the PMA has problems with table names in equity. The PMA cannot recognize keys with capital table names. As soon as I change them to small ones ( ALTER TABLE mytable ENGINE=INNODB - I use INNODB - does this for each table without changing anything else), I was able to access normally. I am on a Windows system with UniformServer.

+12
Jun 26 '16 at 19:02
source share

Just create a new column, set the Name as you like, set the Type to INT and set the A_I flag .

diagram The flag A_I stands for AUTO_INCREMENT , which essentially means that serial numbers are assigned automatically in this new column (see below).

  column1 | column2 | id ----------------------- value | value | 1 ----------------------- value | value | 2 ----------------------- value | value | 3 ----------------------- value | value | 4 

This column essentially serves as a reference for phpMyAdmin to delete rows. If necessary, click a unique button for this new column, although this happened automatically for me. After completing the above steps, you should no longer receive an error message and buttons should appear for editing lines in phpMyAdmin!

+11
Jul 27 '16 at 17:24
source share

An easy fix for this would be to go to the SQL tab and just simply paste the code

 ALTER TABLE `tablename` ADD PRIMARY KEY (`id`); 

Suppose you have a string called id.

+2
Nov 17 '16 at 13:00
source share

In my case, an error occurred in phpmyadmin version 4.5.1, when I set lower_case_table_names = 2 and had a table name with capital letters. The primary key for auto-increment was set in the table, but still showed an error. The problem stopped when I changed the table name to all lowercase letters.

+1
Mar 06 '17 at 9:59 on
source share

So you get rid of this notification and can open the grid cells for editing.

1) click "STRUCTURE"

2) go to the field that you want to use as the primary key (which is usually the 1st key), and then click the "PRIMARY" and "INDEX" fields for this field and accept the PHPMyadmin "OK" pop-up question.

3) pads in the back.

+1
Dec 25 '18 at 21:00
source share

I recently had the same problem, and after finding duplicates, I was able to fix it by simply setting the (missing) primary key in the table. Hope this helps

0
Nov 03 '14 at 9:04 on
source share

This question helped me identify the problem why phpMyAdmin refused me grid-edit-etc. on some tables. I just forgot to declare my primary key and watched it in my decision “Why the hell is this table different from its neighbors” ...

I just wanted to respond as follows in the OP self-update:

In another table there were several AI int values ​​that were the main field, but there were several values ​​of the same type.

A simple solution for this was to simply add a column to the end of the table as a unique AI Int. Basically, all MySQL says it needs a unique value in each record to distinguish between strings.

It was actually my business, but there was no need to add any column: if your primary key is a combination of two fields (for example, a transition table in many respects), just declare it as such:
- eiter in phpyAdmin, just enter "2" in "Create index in columns [x]", then select 2 columns
- or ALTER TABLE mytable ADD PRIMARY KEY(mycol1,mycol2)

0
Feb 26 '15 at 20:44
source share

I got this error when trying to change immediately after starting Query. It turns out that after watching the same query, I managed to change the values.

0
Mar 26 '15 at 20:29
source share

I ran into the same problem when I run a SELECT query with specific columns, although one of the columns is the main one in the table. I tried to get custom posts with custom columns in the standard posts table. The column identifier is already primary and unique.

Simply specifying a primary / unique column name will not solve this problem. You must specify the full name of the column, for example, posts.id (table_name.colon), which the PMA tells you to select a specific column and open editing, etc.

My PMA is 4.3.8. Let me know if this helps.

0
Mar 27 '17 at 2:25
source share

code that worked for me

 ALTER TABLE 'table name' ADD COLUMN 'id' INT NOT NULL AUTO_INCREMENT, ADD PRIMARY KEY ('id'); 
0
Nov 09 '18 at 10:55
source share

For me, this was decided by re-exporting data from the source source database and then importing it into the mirror database.

0
Nov 23 '18 at 10:25
source share

Adding this to the config.inc.php file worked for me (in the last line of $ cfg):

$cfg['RowActionLinksWithoutUnique'] = 'true';

The file should be located in the phpMyAdmin folder on your local computer.

0
Mar 22 '19 at 8:54
source share

Make sure all your tables have one primary key. I forgot to add the primary key to one table, and this solved this problem for me. :)

0
May 11 '19 at 20:07
source share



All Articles