ansible command throwing error while running mysql query with where clause

104 views
Skip to first unread message

anaparthi naresh babu

unread,
Apr 12, 2017, 5:27:43 PM4/12/17
to Ansible Project
Tried running below query and throwing error. Looks issue with single/double quotes. Do we need to use any escape sequence like /"

ansible EM7DBVIPTEST -m shell -a 'silo_mysql -e "update master.system_settings_backup set backup_start_time = "2011-01-01 05:00:00" where id=1"' -c paramiko
Customer0 | FAILED | rc=1 >>
ERROR 1049 (42000): Unknown database '05:00:00 where id=1'

Thanks,
Naresh

Kai Stian Olstad

unread,
Apr 13, 2017, 4:33:27 AM4/13/17
to ansible...@googlegroups.com
On 12. april 2017 11:59, anaparthi naresh babu wrote:
> Tried running below query and throwing error. Looks issue with
> single/double quotes. Do we need to use any escape sequence like /"

Escape is backslash \ not slash /.


> ansible EM7DBVIPTEST -m shell -a 'silo_mysql -e "update
> master.system_settings_backup set backup_start_time = "2011-01-01 05:00:00"
> where id=1"' -c paramiko
> Customer0 | FAILED | rc=1 >>
> ERROR 1049 (42000): Unknown database '05:00:00 where id=1'

Are you trying to run this command?
silo_mysql -e "update master.system_settings_backup set
backup_start_time = "2011-01-01 05:00:00" where id=1"

If so you'll need to escape the double quotes around the date.

--
Kai Stian Olstad
Reply all
Reply to author
Forward
0 new messages