Not sure what you mean by "initialise". Primary key just means that the field in question must (1) be unique and (2) is indexed - there's really nothing to be initialised (that I'm aware of). If you're talking about an auto-incremented integer field, when defining the table you can set the starting auto-increment value by adding auto_increment=123 in the table options section at the end of the table definition.
"Please give us a simple answer, so that we don't have to think, because if we think, we might find answers that don't fit the way we want the world to be."
~ Terry Pratchett in Nation
The MySQL ALTER TABLE command has a DISABLE KEYS clause, but only for nonunique indexes. So, this is irrelevant for primary keys.
The problem with that is that the constraint is supposed to be considered its own entity, entirely separate from the table. of course it only exists as long as the table exists, but its status shouldn't be controlled by the table in that way.
So yes, you can disable a key by altering a table but you can't alter a key's status by itself.
Bookmarks