user3420658
user3420658

Reputation: 1

How to move data from one REMOTE server to another using Putty

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

Answers (3)

RandomSeed
RandomSeed

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

mirelon
mirelon

Reputation: 4996

  1. Create a dump using mysqldump, to a file, let's say temp.sql.
  2. Use scp to copy the file to remote server.
  3. ssh to second remote server.
  4. execute dump on the second remote server.

All can be done within one putty instance.

Upvotes: 1

chaput
chaput

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

Related Questions