2017-06-12 35 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%\";'"