Even wonder how to set mix of two or more MySQL database columns/fields as primary key in phpMyAdmin as there is no direct link during creation of table. This articles with tell you the way to setting composite primary key in phpMyAdmin.
Setting composite primary key in phpMyAdmin
As you can see in the image above we have the following table where we wish to set user_to
and user_by
fields as composite primary so I have created the table above without assigning auto increment to id
column because making a column auto increment will set that as primary key which we don’t want.
Go to table structure tab and select all columns which you wish to set as combination of primary keys and from horizontal options at bottom (just above the border), click to Primary which will set them as composite primary key. You can verify that as after clicking, both column will have underline in their names.