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

Using MySQL packages, files, and services

In this recipe, you will learn about how to install the MySQL database. Make sure the proper configuration file for MySQL is present on the host, and the database service is running.

How to do it...

  1. Configure a new minion in the staging environment called salt-minion-mysql. Create a new state directory called mysql in the staging environment.
  2. Create and edit /opt/salt-cookbook/staging/mysql/init.sls to have the following entries:
    mysql_package: pkg.installed: - name: mysql-server mysql_conf: file.managed: - name: /etc/my.cnf - source: salt://mysql/files/my.cnf - user: root - group: root - mode: 0644 - require: - pkg: mysql_package mysql_service: service: - name: mysqld - running - enable: True - require: - ...

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