I have an mySQL statement that works locally:
mysql -u root -ppassword -e 'SELECT "Column 1 text" as "Column 1 Heading", table1.* FROM table1;' dataBase1
If I try and run it with SSH, it errors out. I don't know how to get the quote in the SQL statement through SSH.
ssh server1 "mysql -u userName -ppassword -e 'SELECT 'Column 1 text' as 'Column 1 Heading', table1.* FROM table1;' dataBase1"
Just need the command written correctly so it runs on the command line. No changes to the system are allowed.
Linux version [url removed, login to view] () (gcc version 4.5.1 20100924 (Red Hat 4.5.1-4) (GCC) ) #1 SMP Fri Oct 22 15:27:53 UTC 2010
"version_comment" "Source distribution"
19 freelancers are bidding on average $17 for this job
I usually do something like this and escape the command watching for asterisks and the like that the shell will try to interpret. echo "escaped_command" | ssh user@host $(< /dev/fd/0)
I'm experienced in shell programming and with ssh - this is what I do everyday on my job. Here in Germany it's after midnight now, that's why i terminate this message with GOOD NIGHT :-)