If you need to add an auto increment field to a MySQL table, you can use the mysql command to do this:
$ mysql -p Enter password: Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 622439 to server version: 4.0.22-standard Type 'help;' or '\h' for help. Type '\c' to clear the buffer. mysql> mysql> connect mydatabase Reading table information for completion of table and column names You can turn off this feature to get a quicker startup with -A Connection id: 622668 Current database: mydatabase mysql> create table tablewithautoincrement ( -> autoincrementfield MEDIUMINT NOT NULL AUTO_INCREMENT, -> PRIMARY KEY (id) -> ); Query OK, 0 rows affected (0.01 sec) mysql> |
Substitute mydatabase with the name of your database, tablewithautoincrement with your table name, and autoincrementfield with your field name.