Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

I've just set up a new linux server to hold my MySQL DB currently running on a Win7 box. I have root access to both machines / DB.

I would like to remotely (from the linux box) connect to the DB on the Win7 box, and copy the DB back to the linux box. I guess mysqldump is the tool of choice, but I'm getting extremely confused with its usage in such case, mixing up the local/remote user/password and DB accesses...

can anyone help ?

thanks

--- EDITED TO COMPLETE QUESTION ---

ok the solution works great, it does what I want. however, is there any way to compress the data before getting it ? my DB is 5GB large but I guess its dump must be must larger (it's been running for 20 minutes and is already at 15GB and counting...

share|improve this question

1 Answer 1

up vote 1 down vote accepted

on the linux box:

mysqladmin -u root -p create databasename
mysqldump -q -u root -p -h 1.2.3.4 databasename > file.sql
mysql -u root -p databasename < file.sql

This assumes that you have granted privileges on the windows box for the linux box to connect.

share|improve this answer
    
it works great ! any way to compress data (I edited question) ? –  Bastien Sep 30 '10 at 3:49
    
@Bastien - something like this: tar czf ./file.sql.gz ./file.sql should be sufficient on a Linux box - on a Windows box (which is where you'll probably want to create the dump if it needs to be compressed) you can use ZIP compression, transfer the file to your Linux box over SCP, and then use gunzip –  danlefree Sep 30 '10 at 4:00
    
@danlefree - yes, I could easily do that on the Win box, but the point is to do everything remotely from the linux box. anyway, the dump process completed shortly after, so I figured out that the time to compress / uncompress such a big base would probably be equivalent to the time it takes to transfer uncompressed on my LAN, so this should be good enough ! thanks ! –  Bastien Sep 30 '10 at 4:15

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.