alter table test add id int not null auto_increment primary key; An auto_increment column needs to be defined as a key. Thatīs why I added the primary key to it. To be sure it needs not be the primary one.
I hate the mysql manual
Well, itīs not as nice as the PHP or Perl one but it tries to be precise by using some form of BNF notation [cui.unige.ch].
ALTER [IGNORE] TABLE tbl_name alter_spec [, alter_spec ...]
where alter_spec is defined as
alter_specification:
ADD [COLUMN] create_definition [FIRST ¦ AFTER column_name ]
Always start reading at the top of the specification and then work your way down to the next item.
Andreas