Adds a databases to the MySQL server.

    name
        The name of the database to manage

    character_set
        The character set, if left empty the MySQL default will be used

    collate
        The collation, if left empty the MySQL default will be used

    CLI Example:

    .. code-block:: bash

        salt '*' mysql.db_create 'dbname'
        salt '*' mysql.db_create 'dbname' 'utf8' 'utf8_general_ci'

def db_create(name, character_set=None, collate=None, **connection_args):
    '''
    Adds a databases to the MySQL server.

    name
        The name of the database to manage

    character_set
        The character set, if left empty the MySQL default will be used

    collate
        The collation, if left empty the MySQL default will be used

    CLI Example:

    .. code-block:: bash

        salt '*' mysql.db_create 'dbname'
        salt '*' mysql.db_create 'dbname' 'utf8' 'utf8_general_ci'
    '''
    # check if db exists
    if db_exists(name, **connection_args):
        log.info('DB \'%s\' already exists', name)
        return False

    # db doesn't exist, proceed
    dbc = _connect(**connection_args)
    if dbc is None:
        return False
    cur = dbc.cursor()
    s_name = quote_identifier(name)
    # identifiers cannot be used as values
    qry = 'CREATE DATABASE IF NOT EXISTS {0}'.format(s_name)
    args = {}
    if character_set is not None:
        qry += ' CHARACTER SET %(character_set)s'
        args['character_set'] = character_set
    if collate is not None:
        qry += ' COLLATE %(collate)s'
        args['collate'] = collate
    qry += ';'

    try:
        if _execute(cur, qry, args):
            log.info('DB \'%s\' created', name)
            return True
    except MySQLdb.OperationalError as exc:
        err = 'MySQL Error {0}: {1}'.format(*exc.args)
        __context__['mysql.error'] = err
        log.error(err)
    return False