Comment 1 for bug 1675220

Revision history for this message
Drew Freiberger (afreiberger) wrote : Re: db-relation-changed hook failed: "You have an error in your SQL syntax;....

From duplicate bug lp#1688401:

strace -s 9000 hooks/db-relation-changed shows:

sendto(3, "1\0\0\0\3CREATE DATABASE hacluster-pxc CHARACTER SET UTF8", 53, 0, NULL, 0) = 53
recvfrom(3, "\262\0\0\1\377(\4#42000You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '-pxc CHARACTER SET UTF8' at line 1",

Fix appears to be adding backticks`{}` around {} in following charmhelpers method call:

charmhelpers/contrib/database/mysql.py: cursor.execute("CREATE DATABASE {} CHARACTER SET UTF8"

Running cs:xenial/percona-cluster (#250) (17.02 charmers release)