Howto Migrate MySQL DB or Table To Another Host

This is an easy script to move a database or table from one MySQL host to another quickly and easily.   The following code can be run straight from the command line with a copy/paste of the variables, or put in a .sh file and run as a script.

fromuser=
frompass=
fromhost=
fromdatabase=
fromtable=
touser=
topassword=
tohost=
todatabase=
emailaddress=

date && mysqldump –user=$fromuser –password=$frompass –                 host=$fromhost –opt –skip-lock-tables  –compress $fromdatabase $fromtable | mysql –user=$touser –password=$topassword –host=$tohost $todatabase && date && echo “script is done” | mailx -s “Script is done” $emailaddress

[ad#google-horzbanner-1]

Facebook Comments