'Attempts to create database AND users AND set privileges'

def grant_privileges(self):

    grant_cmds = ["grant    all    privileges    on    %(name)s.*    TO    '%(user)s'@'localhost'    identified    by    '%(password)s'", "grant    SELECT    on    %(name)s.*    TO    'nobody'@'%%'", "grant    SELECT    on    %(name)s.*    TO    'nobody'@'localhost'", 'FLUSH    PRIVILEGES']
    if (self.admin_connection is None):
        return False
    if (not self.exists()):
        return False
    self.admin_connection.begin()
    cursor = self.admin_connection.cursor()
    for cmd in grant_cmds:
        cmd_ = (cmd % self.config_as_dict())
        try:
            cursor.execute(cmd_)
        except (MySQLdb.ProgrammingError, MySQLdb.OperationalError):
            self.admin_connection.rollback()
            return False
    self.admin_connection.commit()
    return True
