Adds a grant to the MySQL server.

    For database, make sure you specify database.table or database.*

    CLI Example:

    .. code-block:: bash

        salt '*' mysql.grant_add \
            'SELECT,INSERT,UPDATE,...' 'database.*' 'frank' 'localhost'

def grant_add(grant,
              database,
              user,
              host='localhost',
              grant_option=False,
              escape=True,
              ssl_option=False,
              **connection_args):
    '''
    Adds a grant to the MySQL server.

    For database, make sure you specify database.table or database.*

    CLI Example:

    .. code-block:: bash

        salt '*' mysql.grant_add \
            'SELECT,INSERT,UPDATE,...' 'database.*' 'frank' 'localhost'
    '''
    dbc = _connect(**connection_args)
    if dbc is None:
        return False
    cur = dbc.cursor()

    # Avoid spaces problems
    grant = grant.strip()
    try:
        qry = __grant_generate(grant, database, user, host, grant_option, escape, ssl_option)
    except Exception:
        log.error('Error during grant generation')
        return False
    try:
        _execute(cur, qry['qry'], qry['args'])
    except (MySQLdb.OperationalError, MySQLdb.ProgrammingError) as exc:
        err = 'MySQL Error {0}: {1}'.format(*exc.args)
        __context__['mysql.error'] = err
        log.error(err)
        return False
    if grant_exists(
            grant, database, user, host, grant_option, escape,
            **connection_args):
        log.info(
            'Grant \'%s\' on \'%s\' for user \'%s\' has been added',
            grant, database, user
        )
        return True

    log.info(
        'Grant \'%s\' on \'%s\' for user \'%s\' has NOT been added',
        grant, database, user
    )
    return False