I think this might be a bug with MySQL, but I’m not sure. Anyone can tell me how can I create a primary key for a table and then rename the primary constraint? If possible already create the primary key during table creation with the desired name.
All primary keys I create end up with the name “Primary”. Already tried creating an index with the desired name before adding the PK, and renaming the PK using MySQL Workbench. None of them worked.
Anybody have any idea what’s wrong and why can’t I rename the PK name?
Thanks!
I’m not sure that MySQL allows to give names to primary keys in the first place. While there appears to be a syntax for it:
… it doesn’t show up in
information_schema.TABLE_CONSTRAINTSor any other place I could spot so I have the impression that it’s simply silently discarded.The name you see is probably a hard-coded name your GUI client gives to all primary keys.Edit: here’s a quote from the manual: