I want to add another primary key to a table in mysql.
I use phpmyadmin to communicate with mysql server.
When I click the primary icon for the desired field it gives me this error:
#1075 – Incorrect table definition; there can be only one auto column and it must be defined as a key
Edited:
here’s the query:
ALTER TABLE `files` DROP PRIMARY KEY ,ADD PRIMARY KEY ( `file_type` )
How can I do it?
As the name “primary” key says, there may be only one of that (ref: Highlander).
What you might want to try is a UNIQUE KEY, that acts just like a primary for most purpouses. Auto_increment doesn’t seem to fulfill any purpouse if used a second time – what’ts the point of two fields carrying exactly the same information?