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.

  1. Create and edit /opt/salt-cookbook/pillar/staging/mysql/init.sls to have the following entries:
    mysql:
      stg-passwd-hash: '*CAC560C0ED394C2D89B7A1F08422B200B2FFBC26'
  2. Edit /opt/salt-cookbook/pillar/staging/top.sls to have the following entries:
    staging:
      '*':
        - mysql
  3. 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 ...

Get Salt Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.