title: execute mysql on remote server via bash script
body: <p>I need to execute a mysql command on a remote server but seem to be hitting problem when it comes to executing the actual mysql bit</p>
  
  <pre><code>#!/usr/bin/expect -f
  spawn /usr/bin/ssh -t root@10.0.0.2
  expect "password: "
  sleep 1
  send "password\r"
  sleep 2
  /usr/bin/mysql databasename -e "update device_log set status = 'Y' where device_id in ('1','2');"
  </code></pre>
  
  <p>basically I want to change the flag to Y on device id's 1&amp;2</p>
  
  <p>but the script outputs</p>
  
  <p>invalid command name "/usr/bin/mysql" </p>