def dump(
    state, host,
    remote_filename, database=None,
    # Details for speaking to MySQL via `mysql` CLI
    mysql_user=None, mysql_password=None,
    mysql_host=None, mysql_port=None,
):
    '''
    Dump a MySQL database into a ``.sql`` file. Requires ``mysqldump``.

    + database: name of the database to dump
    + remote_filename: name of the file to dump the SQL to
    + mysql_*: global module arguments, see above
    '''

    yield '{0} > {1}'.format(make_mysql_command(
        executable='mysqldump',
        database=database,
        user=mysql_user,
        password=mysql_password,
        host=mysql_host,
        port=mysql_port,
    ), remote_filename)
Dump a MySQL database into a ``.sql`` file. Requires ``mysqldump``.

    + database: name of the database to dump
    + remote_filename: name of the file to dump the SQL to
    + mysql_*: global module arguments, see above