2017-06-12 100 views
0

我想要的bash別名通過ssh通過ssh MySQL查詢執行

ssh [email protected] "mysql wp-theme -e 'DELETE * FROM wp_options where option_name like \'%_transient%\''"; 

但問題運行MySQL查詢與部分\'%_transient%\'在那裏我試圖逃跑'

我有錯誤

bash: -c: line 0: unexpected EOF while looking for matching `'' 
bash: -c: line 1: syntax error: unexpected end of file 
+1

您可以嘗試將\更改爲\\,因爲我認爲我看到了有關這些內容的兩次解釋(一次用於shell,一次用於SQL)。 –

+0

嗯,我仍然有'ssh [email protected]「mysql wp-theme -e'SELECT * FROM wp_options其中option_name像\\'%_ transient%\';''' – tuna

回答

1

經過一段時間,我發現解決方案

ssh [email protected] "mysql wp-theme -e 'DELETE FROM \`wp_options\` where \`option_name\` like \"%_transient%\";'"