Objective: transfer mysql database A on servera to database B on serverb
Environment: Mysql server 5.X, CentOS 5
Steps:
On source mysql database server servera:
mysqldump databasea -u usera -p --single-transaction | gzip > databasea.sql.gz
or
mysqldump databaseA tableA -u usera -p --single-transaction | gzip > tableA.sql.gz
on destination mysql database server serverb:
gunzip < servera.sql.gz | mysql -u userb -p databaseB
--------------
Another way to backup/transfer the whole database to another: (What is the equivalent of Oracle's EXP for export and IMP for import utility in MySQL? [ID 1023112.1])
mysqldump --opt -u root -p*** --all-databases | mysql -u root -p*** -h hostname
mysqldump --opt -u root -p*** --all-databases > backup.sql