简体   繁体   中英

launch mysqldump command to a remote server and save the backup file of mysqldump in the same remote server , in a specific folder

I have a problem with mysqldump..

I know how to launch the mysqldump command from my pc to a remote server and automatically save the mysqldump file in my pc....

 mysqldump --user=... --password=... -h 192.xxx.xxx.xxx dbname > /Specific/folder/of/my pc/dbnamebackup.sql

but if i want to launch mysqldump command to a remote server (from my pc) and save the backup file of mysqldump in the same remote server, in a specific folder.

how can i do this?

i've tried:

mysqldump --user=... --password=... -h 192.xxx.xxx.xxx dbname > -h 192.xxx.xxx.xxx /folder/in/the/same/remote/server/ 

but:

mysqldump: Couldn't find table: "192.xxx.xxx.xxx"

anyone can help me? :)

thanks in advance!!! :)

mysqldump can only write to standard output, and output redirection can only write to local files or locally mounted network drives.

So you'd either need remote login to your server and run mysqldump there, or run it locally and then redirect output into a command that can transfer input to the remote server, eg:

mysqldump ... | ssh 192.xxx.xxx.xxx 'cat > /some/remote/file'

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM