Gardelin
Gardelin

Reputation: 1071

Mysql query execution via ssh

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

ssh [email protected]  "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

Upvotes: 0

Views: 86

Answers (1)

Gardelin
Gardelin

Reputation: 1071

After a while I found the solution

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

Upvotes: 1

Related Questions