Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. It's 100% free, no registration required.

..but then with the ability to store the following on the dump (and thus restore it that way on import);

When doing mysqldump

Store the PRIMARY key counters

When importing my_database_data.sql

LOCK the tables fully (even ignoring PRIMARY key counter checks)

INSERT all data (incl. primary keys)

Set the PRIMARY key counter back to what was saved

UNLOCK the tables again

Other issue

My first thought was to just ignore the PRIMARY keys somehow and just look-increment them again on insertion. The problem is that I can't do this due to their bindings with Foreign Keys, that would then thus break.