2

I can not set/change the primary key for my db table in phpMyAdmin. So far I have tried with a SQL query CREATE, via graphica user interface, manual but nothing works.

Q1: Which is the primary key in the picture?

Q2: How do I change the PK? graphically it doesnt work. enter image description here

Filburt
  • 17,626
  • 12
  • 64
  • 115
MB_iOSDeveloper
  • 4,178
  • 4
  • 24
  • 36

1 Answers1

4

The yellow "Primary" icon underneath the main table is not a legend, it is an action button (see the label "With selected" on the left).

The gray "Primary" icon in the first line indicates that this column is currently part of the primary key. That it is gray indicates that you cannot perform the "Set as Primary Key" action on it.

Just click a (yellow) "Primary" icon inside the table to change the primary key (or tick some checkboxes and click the "Primary" icon at the bottom to create a composite primary key).

I notice this confusing bug: after clicking on one of the "Primary" buttons inside the table, although the primary key has been changed, the screen is not updated.

RandomSeed
  • 29,301
  • 6
  • 52
  • 87
  • Thank you for clarifying the correct answer. I created a new table and tried to change a non-INT row into the PK and it didn't allow me to. The grey key is indeed the PK. Sometimes the PK consists of two rows (which is possible, but in my case not what I wanted to do). The whole setup is a bit confusing, especially for someone using it the first time. – MB_iOSDeveloper Jan 13 '15 at 12:17
  • I would classify this as a UX bug. – Blakedallen Sep 11 '16 at 04:31