salt.states.mysql_user

Management of MySQL users.

NOTE: These states require the MySQLdb python module be installed on the minion, and additional settings added to the minion config file. See the documentation for the mysql module for more information.

frank:
  mysql_user.present:
    - host: localhost
    - password: bobcat

New in version 0.16.1: Authentication overrides have been added.

The MySQL authentication information specified in the minion config file can be overidden in states using the following arguments: connection_host, connection_port, connection_user, connection_pass, connection_db, connection_unix_socket, and connection_default_file.

frank:
  mysql_user.present:
    - host: localhost
    - password: bobcat
    - connection_user: someuser
    - connection_pass: somepass
salt.states.mysql_user.absent(name, host='localhost', **connection_args)

Ensure that the named user is absent

name
The name of the user to remove
salt.states.mysql_user.present(name, host='localhost', password=None, password_hash=None, allow_passwordless=False, **connection_args)

Ensure that the named user is present with the specified properties. A passwordless user can be configured by omitting password and password_hash, and setting allow_passwordless to True.

name
The name of the user to manage
host
Host for which this user/password combo applies
password
The password to use for this user. Will take precedence over the password_hash option if both are specified.
password_hash

The password in hashed form. Be sure to quote the password because YAML doesn't like the *. A password hash can be obtained from the mysql command-line client like so:

mysql> SELECT PASSWORD('mypass');
+-------------------------------------------+
| PASSWORD('mypass')                        |
+-------------------------------------------+
| *6C8989366EAF75BB670AD8EA7A7FC1176A95CEF4 |
+-------------------------------------------+
1 row in set (0.00 sec)
allow_passwordless
If True, then password and password_hash can be omitted to permit a passwordless login.

Note

The allow_passwordless option will be available in version 0.16.1.

Table Of Contents

Previous topic

salt.states.mysql_grants

Next topic

salt.states.network