#!/bin/bash # destination for the backups # mysqlbackup.lst needs to be in this dir, # and list all the db names you want to transfer dest="/home/user/downloads"; user="user"; pass="passwd"; host1="host1.net"; host2="host2.net"; for db in `cat $dest/mysqlbackup.lst` do echo "dumping $db..." /usr/bin/mysqldump -u $user -h $host1 -p$pass $db > $dest/$db.sql echo "creating $db locally..." /usr/bin/mysqladmin -u $user -p$pass create $db echo "importing $db.sql to $db..." /usr/bin/mysql -u $user -h $host2 -p$pass $db < $dest/$db.sql echo "removing $dest/$db.sql..." rm $dest/$db.sql done
Friday, February 22, 2008
shell script to copy all MySQL databases from one server to another
Create an SSH tunnel to connect to remote VNC server
ssh -c 3des -N -L5901:255.255.255.211:5901 -2 -l rory 255.255.255.211 -p 22
Monday, February 18, 2008
Subscribe to:
Posts (Atom)