View Single Post
  #3  
Old 6th March 2013, 05:30
Parsec Parsec is offline
Member
 
Join Date: Jan 2013
Posts: 66
Thanks: 1
Thanked 9 Times in 8 Posts
Default

Or you could do them all at once if you have the root password for mysql

Code:
#!/bin/bash

cd /var/backup
for i in $(/usr/bin/mysql -uroot -p<your_root_password> -e 'show databases'|grep -v Database);

do
if ( test $i != information_schema )
then
/usr/bin/mysqldump -uroot -p<your_root_password> $i > ./$i.dump ;
fi
done
The just go to /var/backup and grab them (this assumes you have a /var/backup dir - if not change it to something else in the script.
Reply With Quote