Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

MySQLDump to local machine from remote server connected via SSH

Tags:

ssh

mysqldump

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?

like image 648
Da11aS Avatar asked Apr 09 '13 04:04

Da11aS


People also ask

How do I connect to a remote MySQL server using SSH?

Open a new terminal window. Direct your local MySQL client to 127.0. 0.1:3306 with the MySQL server username and password. Your connection to the remote MySQL server will be encrypted through SSH, allowing you to access your databases without running MySQL on a public IP.


1 Answers

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 
like image 89
Hunter Zhao Avatar answered Sep 17 '22 15:09

Hunter Zhao