Reputation: 1
I have a bunch of MySQL table data on three different remote servers which I access using Putty. I need to copy some of the tables from one of the remote servers to another. I've only ever copied data from my local machine to one of the servers. How do I go about copying the data between the remote servers?
Upvotes: 0
Views: 1583
Reputation: 29769
Pipe mysqldump
to mysql
:
bash> mysqldump -hremote_source [-ulogin_on_source] source_database [source_table1 ...] \
|mysql -hremote_target [-ulogin_on_target] [target_databasee]
But this is sub-optimal, as all data will transit via your local host. If you have shell access to one of the two remotes, then it is better to proceed this way:
bash@localhost> ssh shell_login@remote_source
bash@remote_source> mysqldump [-hlocalhost] |mysql -hremote_target
... or the other way around:
bash@localhost> ssh shell_login@remote_target
bash@remote_target> mysqldump -hremote_source |mysql [-hlocalhost]
Obviously, the above assumes that remote access to mysql is allowed from/to either the one, or the other, or both servers.
Upvotes: 1
Reputation: 4996
All can be done within one putty instance.
Upvotes: 1
Reputation: 101
I presume they are all linux server:
directly on the server you could dump you table and copy it to the other server with
scp : scp table.txt username@mysqlServer2:/path/where/you/want/to/copy
sftp : username@mysqlServer2
Upvotes: 0