简体   繁体   中英

Mysql query execution via ssh

I want to make bash alias to run mysql query via ssh

ssh vagrant@192.168.10.10  "mysql wp-theme -e 'DELETE * FROM wp_options where option_name like \'%_transient%\''";

but problem is with part \\'%_transient%\\' where i tried to escape '

I got error

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

一段时间后,我找到了解决方案

ssh vagrant@192.168.10.10  "mysql wp-theme -e 'DELETE FROM \`wp_options\` where \`option_name\` like \"%_transient%\";'"

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM