Trying to set mysql user privileges with fabric.
run("mysql -u %s -p%s -e 'grant all on %s.* to '%s'@'localhost' identified by 'PASSWORD'" % (user, dbpasswd, account))
Error
TypeError: not enough arguments for format string
Any idea ? Thanks a lot !
run('mysql -u %s -p%s -e "grant all on %s.* to '%s\'@\'localhost' identified by 'PASSWORD'"' % (user, dbpasswd, account, account))
SyntaxError: unexpected character after line continuation character
Change your tuple to (user, dbpasswd, account, user)
and you should be good. This error happens because you have 4 replacements tokens (%s) but only have 3 items in your tuple.
来源:https://stackoverflow.com/questions/11392721/python-fabric-mysql-privileges