mysql copy table from one database to another using command line

Easiest way to copy a table from one database to another use mysqldump.

Example:
Echo off
Echo ***Please Wait DataBase Transfering***
(cd C:\ && ^
mysql -h 192.168.1.235 -u root -psiva@1234 --port=3306 -e "CREATE DATABASE IF NOT EXISTS `DestinationDatabaseName`" && ^
mysqldump --routines=true -h 192.168.1.225 -u root -psiva@1234 --port=3306  SourceDatabaseName TableName | mysql -h 192.168.1.235 -u root -psiva@1234 --port=3306 DestinationDatabaseName)> transferlog150331.txt  2>&1
Echo ***
Timeout 10

Post a Comment

0 Comments