Answer the question
In order to leave comments, you need to log in
How to output mysqldump result to remote server via ssh?
I connect via ssh to the server, sending commands to it via plink (writing them into a .bat file).
My script looks like this:
C:/mypath/plink.exe -batch ^
[email protected] -pw mypassword ^
"mysqldump -u database_user -pdbpass database_name > mysqlBackup/dbdump.sql"
pause
mysqldump -u database_user -pdbpass database_name | gzip > mysqlBackup/dbdump.sql.gz
scp C:/mypath/ [email protected]:~/mysqlBackup/dbdump.sql.gz
Answer the question
In order to leave comments, you need to log in
I found what was the problem, it turns out that escape characters in my script - "^", in an incomprehensible way to me influenced the script, and specifically - "^" immediately before the quotes, which contain the transmitted command to be executed on a remote machine, i.e. I rewrote the whole command:
C:/mypath/plink.exe -batch ^
[email protected] -pw mypassword ^
"mysqldump -u database_user -pdbpass database_name > mysqlBackup/dbdump.sql"
we connect via ssh to a remote host
, we do what we need in the console
from the local computer, we execute sftp on the host (you can use winscp)
we take the result
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question