PARALLAX

mysql_user

Manage MySQL and MariaDB user accounts and privileges

Collection: ansible.mysql

Full Name: parallax.community.general.mysql_user

Aliases: community.general.mysql_user, mysql_user, ansible.mysql.mysql_user

Synopsis

Manage MySQL and MariaDB user accounts and privileges

Parameters

NameTypeRequiredDefaultDescription
namestringyesName of the MySQL user
passwordstringPassword for the user
hoststringlocalhostThe host part of the MySQL username
statestringpresentState of the user Choices: present, absent
privrawMySQL privileges string (e.g. db.*:ALL)
login_hoststringlocalhostHost running MySQL
login_portint3306Port of the MySQL server
login_userstringrootUser to authenticate with
login_passwordstringPassword for authentication
login_unix_socketstringPath to a Unix socket for local connections
encryptedboolfalseWhether the password is already encrypted
append_privsboolfalseAppend privileges instead of overwriting
check_implicit_adminboolfalseCheck if mysql allows login as root without password
update_passwordstringalwaysWhen to update the password Choices: always, on_create
pluginstringAuthentication plugin for the user
plugin_auth_stringstringAuthentication string for the plugin
plugin_hash_stringstringAuthentication hash for the plugin
resource_limitsrawResource limits for the user (JSON format)
tls_requiresrawTLS requirements for the user
subtract_privsboolfalseRemove only the specified privileges
host_allboolfalseApply to all existing hosts for this user
lockedboolLock or unlock the account
saltstring20-byte salt for caching_sha2_password plugin authentication
client_certstringClient TLS certificate
client_keystringClient TLS private key
ca_certstringTLS certificate authority
check_hostnameboolVerify the server hostname
connect_timeoutint30Connection timeout in seconds
config_filestringAdditional MySQL client option file

Example

yaml
- name: Grant the application user access to its database
  mysql_user:
    name: app
    password: "{{ mysql_app_password }}"
    host: "10.0.%"
    priv: "appdb.*:ALL"
    state: present
Search
    ↑ ↓ move↵ openesc close