I am migrating a database to MySQL 5.0. Several tables should have their primary key as an auto_increment integer. The database being copied has records with the primary key beginning with zero (0). These keys are foreign keys so it is not desirable to change their values.
Here is what I have been trying:
(1) Truncate table <tablename>;
(2) Alter table <tablename> modify recid integer not null default 0;
(3) <insert rows into table>
(4) Alter table <tablename> modify recid integer not null auto_increment;
When I execute statement number 4, above, if the recid has been inserted with a value of zero, then MySql is changing the zero to one.
How can I get MySql to let me load my values into the column and to set the auto_increment to the max(recid) + 1 ?