Mysql Facts

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 granted privileges for each:

{
    '`pyinfra_stuff`.*': {
        'privileges': [
            'SELECT',
            'INSERT'
        ],
        "with_grant_option": false
    },
}

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,
        ...
    },
}