mysqldump --opt --user=username --password=password --host=yourMySQLHostname dbname > output.sql
Script
domains=( yourdomain.com yourdomain2.com )
sqldbs=( yourdb1 yourdb2 )
opath=$HOME/backup/
mysqlhost=mysqlhostname
username=mysqlusername
password=mysqlpassword
suffix=$(date +%m-%d-%Y)
for (( i = 0 ; i < ${#domains[@]} ; i++ ))
do
cpath=$opath${domains[$i]}
if [ -d $cpath ]
then
filler="just some action to prevent syntax error"
else
echo Creating $cpath
mkdir -p $cpath
fi
mysqldump -c -h $mysqlhost --user $username --password=$password ${sqldbs[$i]} > ${cpath}/${sqldbs[$i]}_$suffix.sql
done
No comments:
Post a Comment