Difference between revisions of "Talk:MySQL - dumping and restoring"

From WPKG | Open Source Software Deployment and Distribution
Jump to: navigation, search
(Different method proposed)
 
m
 
Line 7: Line 7:
  
 
-- Tor (tor@tblab.net)
 
-- Tor (tor@tblab.net)
 +
 +
: Sure it would. If you can do the dump right now. In that case, dumping the database and restoring it a second later doesn't make sense anyway ;) The example shown on a previous page is useful if you have a full dump already i.e. from a backup made one week or month earlier.

Latest revision as of 05:49, 8 April 2009

Wouldn't it be easier to do this in a for loop instead? Something like this:

for i in $(echo 'SHOW DATABASES;' | mysql -u<username> -p<password> | grep -v '^Database$'); do mysqldump --<some-options-for-mysqldump> $i > db-backup_$i.sql done

-- Tor (tor@tblab.net)

Sure it would. If you can do the dump right now. In that case, dumping the database and restoring it a second later doesn't make sense anyway ;) The example shown on a previous page is useful if you have a full dump already i.e. from a backup made one week or month earlier.