How do I export a database but export the tables based on their date created? B/C I'm facing this issue where when exporting this database, since some of the tables have foreign keys and linked to other tables by their keys, how do I export t开发者_JS百科o overcome that issue?
If you want to export the tables of a database in order by date created you can use SQLyog Scheduled backup, where you have:
- An option to add a TIMESTAMP to the backup file name
- An option to backup a complete database or only individual tables
- An option to backup to a single file or to split the backup into more files
- An option to store the backup files in a single folder or a 'folder tree'
There is also an option to SET foreign_key_checks = 0; while taking backup so that you don't run into any foreign key related issues ;-)
Actually, I think what you want is to add a couple of lines to the import file when inserting rows:
SET foreign_key_checks = 0;
-- insert rows
SET foreign_key_checks = 1;
This way the inserts can occur in any order.
精彩评论