import configparser


def read_db_config(filename='config.ini', section='mysql'):
    """Reads database configuration from file.

    Args:
        filename: The filename as a string.
        section: The INI section with the config information as a string.

    Returns:
        A dict containing database configuration information.

    Raises:
        Exception: Failure to find file or to load all config information.
    """
    parser = configparser.ConfigParser()
    try:
        parser.read(filename)
    except:
        raise Exception('{} not found!'.format(filename))

    db = {}
    if parser.has_section(section):
        items = parser.items(section)
        for item in items:
            db[item[0]] = item[1]
    else:
        raise Exception('{0} not found in file {1}'.format(section, filename))

    return db