I am using Django and only want to backup mysql data (not it's structure; Django will do that, and it will otherwise mess up Django-South's migration checks).
- my tables are almost all intertwined with each other by Foreign Key bindings.
- I'm currently having over 100 tables that hold all my data.
What I'm trying to achieve is some mechanism with
mysqldump to dump my data, like so;
imac2011:Desktop allendar$ /Applications/MAMP/Library/bin/mysqldump -u root -p my_database --no-create-info > my_database_data.sql
..and restore it like so;
imac2011:Desktop allendar$ /Applications/MAMP/Library/bin/mysql -u root -p my_database < my_database_data.sql
..but then with the ability to store the following on the dump (and thus restore it that way on import);
- Store the PRIMARY key counters
- 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
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.