Set or change the primary key

See Also

MySQL does not allow one to change indexes. What must be done is to first delete the primary key and then create it again.

1. Open the table in Design View

2. Select the Index.gif Index tab

3. If there is an existing
primary key defined for the table, select the row of the primary key and select IndexDelete.gif Delete from the Index menu

4. To add a primary key definition, select IndexInsert.gif Add from the Index menu

5. In the Name column enter a name for the primary key (the name can be anything because MySQL replaces it with PRIMARY)

6. In the Field Name column select the field that must form part of the primary key. If the primary key must consist of more than one field, just add or insert new rows below the current one and specify the field name in the Field Name column

7. Select Save.gif Save… or SaveAs.gif Save As… from the File menu when you are ready to save the table

Note: All the fields that are part of the primary key may not allow Null values