MySQLDump通过SSH连接远程服务器到本地机器

时间:2021-04-27 22:44:27
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?

我在命令行中有什么问题吗?

3 个解决方案

#1


61  

Use like this:

使用这样:

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

Hope to help you:)

希望能帮到你:)


Edition for linux

适用于Linux的版本

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

#2


2  

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.

只需从本地计算机上的命令提示符运行mysqldump -h xxx.xxx.xxx.xxx -u username -ppassword databasename> C:\ path \ to \ store \ file。

#3


0  

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

我不明白为什么你在你的问题中涉及ssh但是......

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.

如果那些工作你的命令应该工作。

#1


61  

Use like this:

使用这样:

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

Hope to help you:)

希望能帮到你:)


Edition for linux

适用于Linux的版本

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

#2


2  

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.

只需从本地计算机上的命令提示符运行mysqldump -h xxx.xxx.xxx.xxx -u username -ppassword databasename> C:\ path \ to \ store \ file。

#3


0  

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

我不明白为什么你在你的问题中涉及ssh但是......

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.

如果那些工作你的命令应该工作。