Creating MySQL database users
Setting up users and giving them proper permissions to access databases is one of the most critical tasks in database management. In this recipe, you will learn how to create database users and manage their access from different servers.
How to do it...
We will use the same minion as the previous recipe.
Create and edit
/opt/salt-cookbook/pillar/staging/mysql/init.sls
to have the following entries:mysql: stg-passwd-hash: '*CAC560C0ED394C2D89B7A1F08422B200B2FFBC26'
Edit
/opt/salt-cookbook/pillar/staging/top.sls
to have the following entries:staging: '*': - mysql
Create and edit
/opt/salt-cookbook/staging/mysql/users.sls
to have the following entries:include: - mysql.database db_user: mysql_user.present: - name: stg-db - host: '*' - password_hash: '{{ pillar['mysql']['stg-passwd-hash'] }}' - connection_charset: utf8 - saltenv: - LC_ALL: "en_US.utf8" - require: - mysql_database: stg_databases
Edit
/opt/salt-cookbook/staging...