Reputation: 71
i have a MySQL query like this
cursor.execute("GRANT USAGE ON %s.* TO %s@%s", [db, user, host])
Python generate a query like
GRANT USAGE ON 'db'.* TO 'user'@'host';
But the apostrophes around 'db' are not allowed in MySQL. Any ideas?
Upvotes: 0
Views: 123
Reputation: 7032
A simple way to get around this.
grant = "GRANT USAGE ON %s.* TO '%s'@'%s'" % [db, user, host]
cursor.execute(grant)
HTH
Upvotes: 1