Tip #766 Migrate MySQL Database to a new Server
Tip 669 gave a command to copy a table between remote MySQL databases, but how about if you want to copy the whole DB to a new host?The following command will copy the database 'old_db' from the local host to 'new_db' on the specified remote host.
mysqldump --add-drop-table --extended-insert --force --log-error=err.log -u[user] \ -p[pass] old_db | ssh -C user@host "mysql -u[user] -p[pass] new_db"
- TAGS:
- mysql
alias aptitude at awk bash bc cal cat cd colrm comm cp csh curl cut date dd df dialog diff dirname dpkg du fc find fuser grep gs gzip history iconv kill ksh last less ln ls lsof lynx m4 md5sum mkdir mkfifo mkisofs mv mysql nc netstat openssl OSX perl ping popd ps pushd python read redirection rm scp screen sed sort ssh stat sudo svn tail tar tee test top tr uniq vim wc wget xargs