mysql password containing @ generates a syntax error

Issue #258 resolved
jase_t created an issue
$ monit reload
/usr/local/etc/monit/includes/mysql:9: syntax error 'dSUgn@x5dnSXivY'

$ grep -C2 'dSUgn@x5dnSXivY' /usr/local/etc/monit/includes/mysql
  group database
  depends mysql_init, mysql_bin
  if failed unixsocket /tmp/mysql.sock protocol mysql username monit password dSUgn@x5dnSXivY for 2 cycles then restart
  if not exist 2 cycles then restart
  if 5 restarts within 15 cycles then unmonitor

Upon changing the password to something that doesn't contain @, monit reloads the config file successfully.

Comments (5)

  1. Tildeslash repo owner

    You need to use quotes:

    if failed unixsocket /tmp/mysql.sock protocol mysql username monit password "dSUgn@x5dnSXivY" for 2 cycles then restart
    
  2. jase_t reporter

    Ah, that does indeed work. Not sure why I didn't try that in the first place. Thanks for the quick response!

    Any chance the documentation for mysql protocol could be updated to reflect this please, as I did check and there's no mention of the need for quoting. Only mention I can see for quoting non-alphanumerics is in the web interface Authentication section.

  3. Log in to comment