Connect via ssh to the server, sending it commands via plink (writing them in .bat file).
My script looks like this:
C:/mypath/plink.exe -batch ^
email@example.com -pw mypassword ^
"mysqldump -u database_user -pdbpass database_name > mysqlBackup/dbdump.sql"
While mysqldump is running on a remote machine, but the result writes to a file mysqlBackup/dbdump.sql on the local machine, which naturally takes a lot of time. How to specify in the command that the result should be written to a file in the same place, on the remote machine?
I would also like to drive to gzip, that is:
mysqldump -u database_user -pdbpass database_name | gzip > mysqlBackup/dbdump.sql.gz
and then actually upload the resulting backup on the local machine:
scp C:/mypath/ firstname.lastname@example.org:~/mysqlBackup/dbdump.sql.gz