I have a scenario. I need to connect to a windows server from a unix machine using sshpass and execute a MySQL query remotely. Below is the code I want to run:
sshpass -p 'passwd' ssh -q -o StrictHostKeyChecking=no Administrator@IP mysql -uroot db_name -P 3306 -e "select date(lastupdate),circlecode,count(*) from some_table where date(lastupdate)='2017-05-17' group by 1;"
If I separate the two commands i.e. login and MySQL query it runs fine
sshpass -p 'passwd' ssh -q -o StrictHostKeyChecking=no Administrator@IP
mysql -uroot db_name -P 3306 -e "select date(lastupdate),circlecode,count(*) from some_table where date(lastupdate)='2017-05-17' group by 1;"
I have tried multiple solutions for similar cases I found on net but none works.
Please help. Thanks in advance.