Mysql Facts

See also: Mysql Operations.

mysql.MysqlDatabases

host.get_fact(MysqlDatabases, mysql_user=None, mysql_password=None, mysql_host=None, mysql_port=None)

Returns a dict of existing MySQL databases and associated data:

{
    "mysql": {
        "character_set": "latin1",
        "collation_name": "latin1_swedish_ci"
    },
}

mysql.MysqlUserGrants

host.get_fact(MysqlUserGrants, user, hostname='localhost', mysql_user=None, mysql_password=None, mysql_host=None, mysql_port=None)

Returns a dict of <database>`.<table> with a set of granted privileges for each:

{
    "`pyinfra_stuff`.*": {
        "SELECT",
        "INSERT",
        "GRANT OPTION",
    },
}

mysql.MysqlUsers

host.get_fact(MysqlUsers, mysql_user=None, mysql_password=None, mysql_host=None, mysql_port=None)

Returns a dict of MySQL user@host’s and their associated data:

{
    "user@host": {
        "privileges": ["Alter", "Grant"],
        'max_connections': 5,
        ...
    },
}