Da11aS
Da11aS

Reputation: 465

MySQLDump to local machine from remote server connected via SSH

mysqldump -h xxx.xxx.xxx.xxx -u username -ppassword databasename > C:\path\to\store\file

It seemed to work as it paused while the file was downloading, however no file appears once it completes.

Do I have something wrong in the command line?

Upvotes: 32

Views: 65169

Answers (3)

Tash Pemhiwa
Tash Pemhiwa

Reputation: 7685

Simply run mysqldump -h xxx.xxx.xxx.xxx -u username -ppassword databasename > C:\path\to\store\file from the command prompt on your local machine.

Upvotes: 2

Hunter Zhao
Hunter Zhao

Reputation: 4649

Use like this:

mysqldump -P3306  -h192.168.20.151 -u root -p database > c:/my.sql

Hope to help you:)


Edition for linux

mysqldump -u root -p databasename > ~/Downlaods/filename.sql

Upvotes: 71

Andreas Wederbrand
Andreas Wederbrand

Reputation: 39981

I don't understand why you involve ssh in your question but...

First try the same command without redirecting it to a file to see that you can connect to the database.

Second make sure that you can write to that location (try to create and edit a file in the same path).

If those to work your command should work.

Upvotes: 0

Related Questions