I need to script a mysql restore of a linux machine from a windows machine. I have putty and I know it has ssh capability. Here is what I have:
C:\Progra~1\Putty\putty.exe -ssh root@10.1.2.3 && mysql -u USER -pPASS db < /tmp/dump.sql
My problem in writing a script is that putty opens a new window and transfers control there, so anything coming after
putty.exe -ssh
doesn’t do anything.
You can use the
-moption to specify a file which contains a command to run on the remote connection.Example:
Contents of
C:\cmd.txtFrom the Putty Documentation: