Creating MySQL databases and users

MySQL is a very widely used database server, and it's fairly certain you'll need to install and configure a MySQL server at some point. This recipe will show you how to do that, as well as how to automatically create databases and users for applications.

Getting ready…

  1. If you don't already have a MySQL module, let's create one:
    # mkdir /etc/puppet/modules/mysql
    # mkdir /etc/puppet/modules/manifests
    # mkdir /etc/puppet/modules/files
    
  2. Create the file /etc/puppet/modules/mysql/manifests/server.pp with the following contents:
    class mysql::server { package { "mysql-server": ensure => installed } service { "mysql": enable => true, ensure => running, require => Package["mysql-server"], } file { "/etc/mysql/my.cnf": owner ...

Get Puppet 2.7 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.