O'Reilly logo

Salt Cookbook by Anirban Saha

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required