Nice programing

해결 :이 테이블은 고유 한 열을 포함하지 않습니다.

nicepro 2021. 1. 7. 21:20
반응형

해결 :이 테이블은 고유 한 열을 포함하지 않습니다. 그리드 편집, 확인란, 편집, 복사 및 삭제 기능을 사용할 수 없습니다.


이것은 질문이 아니라 자체 생성 된 문제 / 질문 및 내가 작동하는 해결책입니다. 내가 찾을 수있는 완전한 작업 솔루션이 없었기 때문에 공유하는 것이 괜찮은 예의라고 생각했습니다.

phpMyAdmin에서 생성 된 오류는 다음과 같습니다.

"이 테이블은 고유 한 열을 포함하지 않습니다. 그리드 편집, 확인란, 편집, 복사 및 삭제 기능을 사용할 수 없습니다."

정확한 시나리오에 따라 몇 가지 작업 솔루션이 있습니다.

예를 들어 모든 AI 또는 고유 식별자 필드가 고유 한 경우 테이블을 변경하고 이것이 기본 키인지 확인하고 고유 값으로 설정되도록 할 수 있습니다.

내 테이블 중 하나 에서이 솔루션으로 이것을 해결했습니다.

다른 테이블에는 Primary 필드 인 여러 AI int 값이 있지만 동일한 종류의 값이 여러 개있었습니다.

이에 대한 간단한 수정은 테이블 끝에 Unique AI Int로 열을 추가하는 것입니다. 기본적으로 모든 MySQL은 행을 구별하기 위해 각 레코드에 고유 한 값이 필요하다고 말합니다.

도움이 되었기를 바랍니다.


나는이 문제에 직면했다.

원인은 테이블 에 기본 키 필드가 없기 때문입니다 .

그리고 간단한 해결책이 있습니다. 비즈니스 로직에 맞는 특정 필드에 필드를 기본 키로 설정합니다.

예를 들어 데이터베이스 thesis_db와 필드 가 있습니다. 기본 키 필드가되도록 thesis_id설정 thesis_id하려면 기본 버튼 (키 아이콘)을 누릅니다.

여기에 이미지 설명 입력


이것은 오류가 아닙니다. PhpMyAdmin은 결과 세트에 고유 ID 열이 없다는 것을 알려줍니다. 보낸 쿼리 유형에 따라 이것이 원하는 동작입니다.

결과 집합의 열 조합이 고유 한 경우 해당 열의 값을 UPDATE 또는 DELETE 쿼리에 사용할 수있는 고유 ID가 필요하다는 것은 MySQL이 아닙니다. phpMyAdmin은 고유 ID가있는 결과 세트에서 일반적으로 볼 수있는 확인란과 버튼을 제공하기에 충분한 정보가 없다고 말합니다.


제 경우는 다릅니다. 이 문제는 PHPMyAdmin에만 해당됩니다. 몇 가지 다른 관리 도구 (Adminer, MySQLWorkbench, HeidiSQL 등)를 다운로드했으며 동일한 db가 모두 잘 작동합니다.

모든 인덱스, 기본 키 및 고유 키가 정의되어 있지만 여전히 오류가 발생합니다. MySQL 5.6으로 업그레이드 한 후이 문제가 발생합니다 (이전 버전과 동일하지 않음).

PMA에 대문자로 된 테이블 이름에 문제가 있음이 밝혀졌습니다. PMA는 대문자 테이블 이름이있는 키를 인식 할 수 없습니다. 일단 그것들을 작게 변경하면 ( ALTER TABLE mytable ENGINE=INNODB-INNODB를 사용합니다-다른 아무것도 변경하지 않고 각 테이블에 대해 수행) 정상적으로 액세스 할 수있었습니다. 저는 UniformServer가있는 Windows 시스템을 사용하고 있습니다.


단순히 새 열을 만듭니다 설정 Name무엇을 당신이 좋아하는 설정 Type으로 INT하고 말한다 확인란을 선택합니다A_I .

도표A_I선택란을 의미 AUTO_INCREMENT본질적 시퀀스 번호가 (아래 참조)이 새로운 항목으로 자동적으로 할당되는 것을 의미한다.

 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!


An easy fix to this would be going to the SQL tab and just simply put in the code

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

Asuming that you have a row named id.


In my case, the error occured in phpmyadmin version 4.5.1 when i set lower_case_table_names = 2 and had a table name with uppercase characters, The table had a primary key set to auto increment but still showed the error. The issue stopped when i changed the table name to all lowercase.


This is how you get rid of that notice and be able to open those grid cells for edit

1) click "STRUCTURE"

2) go to the field you want to be a primary key (and this usually is the 1st one ) and then click on the "PRIMARY" and "INDEX" fields for that field and accept the PHPMyadmin's pop-up question "OK".

3) pad yourself in the back.


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

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

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


I have been faced this problem.

The cause is your table don't have a primary key field.

And I have a simple solution: Set a field to primary key to specific filed that suit with 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


I recently got the same problem and after looking for duplicates I was able to fix it just by setting (missing) primary key on the table. Hope this could help


This question helped me identify the problem of why phpMyAdmin refused me grid-edit-etc. on some tables. I just had forgotten to declare my primary key and was overseeing it in my "Why the hell should this table be different from its neighbours" solution search process...

I just wanted to react on following in OP self-answer:

The other table had multiple AI int values that were the Primary field, but there were multiple values of the same kind.

The simple fix for this was to just add a column to the end of the table as Unique AI Int. Basically all MySQL is saying is it needs a unique value in each record to differentiate the rows.

This was actually my case, but there's absolutely no need to add any column: if your primary key is the combination of 2 fields (ex. junction table in many to many relationship), then simply declare it as such:
- eiter in phpyAdmin, just enter "2" in "Create an index on [x] columns", then select your 2 columns
- or ALTER TABLE mytable ADD PRIMARY KEY(mycol1,mycol2)


I got this error when trying to modify directly after running Query. Turns out, after making a view from that exact same query, I was able to modify the values.


I faced the same problem whenever i am firing SELECT query with specific columns, though the one of the column is primary in table. I was trying to fetch selective records with selective columns in standard wordpress "posts" table. ID column is already primary and unique..

기본 / 고유 열 이름을 지정하는 것만으로는이 문제가 해결되지 않습니다. PMA에게 특정 열을 선택하도록 지시하고 편집 등을 표시하는 "posts.id"(tablename.columnname)와 같은 전체 열 이름을 지정해야합니다.

내 PMA는 4.3.8입니다. 도움이되는지 알려주세요 ..


나를 위해 일한 코드

ALTER TABLE `table name`
ADD COLUMN `id` INT NOT NULL AUTO_INCREMENT,
ADD PRIMARY KEY (`id`);

이 문제는 원본 원본 DB에서 데이터를 다시 내 보낸 다음 미러 DB로 가져 와서 해결되었습니다.


모든 테이블에 하나의 기본 키가 있는지 확인하십시오. 하나의 테이블에 기본 키를 추가하는 것을 잊었고이 문제가 해결되었습니다. :)

참조 URL : https://stackoverflow.com/questions/18922503/resolution-this-table-does-not-contain-a-unique-column-grid-edit-checkbox-ed

반응형