Last Updated: February 25, 2016
·
860
· fabiandelgado

Copy database to a new server using ssh

Dump MYSQL in old server

mysqldump namebd -u userdb -p > name_db.sql

Copy a new server from old

rsync -avz -e ssh --progress /var/lib/mysql/namedb.sql root@IPServer:/var/lib/mysql

Create Database in new server

mysqladmin -u userdb -p create namedb

Import a database in new server

mysql namedb -u userdb -p < name_db.sql

/var/lib/mysql : directory mysql in debian