rustybuddy — 2010-03-09T10:24:03-05:00 — #1
I have a database with approx 100 tables. I want to write a process that exports this database as a .sql file.
Easy enough right? Well... maybe not. I want some of the tables to export the data inside them, and other tables to export as empty with keys set to 0.
I'm using php but a ssh command would work fine as well.
Thanks in advance for any guidance or suggestions you may be able to provide.
philiptoop — 2010-03-09T11:28:18-05:00 — #2
It might be worth having a look at the mysqldump utility. This allows you to dump structure and data and allows a wealth of options. Although to get the flexibility you want you might need to execute it a number of times.
rustybuddy — 2010-03-09T11:41:23-05:00 — #3
What if a different approach was used?
What if I just copied (and renamed) the entire database and ran 'EMPTY' on all the tables I wanted emptied?