{"id":13545728,"url":"https://github.com/puppetlabs/puppetlabs-mysql","last_synced_at":"2025-05-14T13:08:24.801Z","repository":{"id":839173,"uuid":"1797486","full_name":"puppetlabs/puppetlabs-mysql","owner":"puppetlabs","description":"MySQL Puppet Module / Manifests + Types \u0026 Providers","archived":false,"fork":false,"pushed_at":"2025-04-23T12:15:37.000Z","size":15093,"stargazers_count":381,"open_issues_count":62,"forks_count":794,"subscribers_count":192,"default_branch":"main","last_synced_at":"2025-05-08T15:04:58.219Z","etag":null,"topics":["hacktoberfest","module","supported"],"latest_commit_sha":null,"homepage":"","language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/puppetlabs.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":"CODEOWNERS","security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2011-05-25T06:10:41.000Z","updated_at":"2025-05-03T06:51:47.000Z","dependencies_parsed_at":"2024-11-26T00:03:44.793Z","dependency_job_id":"8d1c97b0-e736-4524-99f1-36a43dad0287","html_url":"https://github.com/puppetlabs/puppetlabs-mysql","commit_stats":{"total_commits":1423,"total_committers":398,"mean_commits":"3.5753768844221105","dds":0.9121574139142656,"last_synced_commit":"be2a27c6bd98b0f3bd0b49c58f327d07831ea2b1"},"previous_names":[],"tags_count":86,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/puppetlabs%2Fpuppetlabs-mysql","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/puppetlabs%2Fpuppetlabs-mysql/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/puppetlabs%2Fpuppetlabs-mysql/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/puppetlabs%2Fpuppetlabs-mysql/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/puppetlabs","download_url":"https://codeload.github.com/puppetlabs/puppetlabs-mysql/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253092170,"owners_count":21852753,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["hacktoberfest","module","supported"],"created_at":"2024-08-01T11:01:12.402Z","updated_at":"2025-05-14T13:08:19.784Z","avatar_url":"https://github.com/puppetlabs.png","language":"Ruby","funding_links":[],"categories":["Ruby"],"sub_categories":[],"readme":"# mysql\n\n#### Table of Contents\n\n1. [Module Description - What the module does and why it is useful](#module-description)\n2. [Setup - The basics of getting started with mysql](#setup)\n    * [Beginning with mysql](#beginning-with-mysql)\n3. [Usage - Configuration options and additional functionality](#usage)\n    * [Customize server options](#customize-server-options)\n    * [Create a database](#create-a-database)\n    * [Customize configuration](#customize-configuration)\n    * [Work with an existing server](#work-with-an-existing-server)\n    * [Specify passwords](#specify-passwords)\n    * [Install Percona server on CentOS](#install-percona-server-on-centos)\n    * [Install MariaDB on Ubuntu](#install-mariadb-on-ubuntu)\n    * [Install Plugins](#install-plugins)\n    * [Use Percona XtraBackup](#use-percona-xtrabackup)\n4. [Reference - An under-the-hood peek at what the module is doing and how](REFERENCE.md)\n5. [Limitations - OS compatibility, etc.](#limitations)\n6. [License](#license)\n7. [Development - Guide for contributing to the module](#development)\n\n## Module Description\n\nThe mysql module installs, configures, and manages the MySQL service.\n\nThis module manages both the installation and configuration of MySQL, as well as extending Puppet to allow management of MySQL resources, such as databases, users, and grants.\n\n## Setup\n\n### Beginning with mysql\n\nTo install a server with the default options:\n\n`include mysql::server`.\n\nTo customize options, such as the root password or `/etc/my.cnf` settings, you must also pass in an override hash:\n\n```puppet\nclass { 'mysql::server':\n  root_password           =\u003e 'strongpassword',\n  remove_default_accounts =\u003e true,\n  restart                 =\u003e true,\n  override_options        =\u003e $override_options,\n}\n```\n\nNota bene: Configuration changes will only be applied to the running\nMySQL server if you pass true as restart to mysql::server.\n\nSee [**Customize Server Options**](#customize-server-options) below for examples of the hash structure for $override_options.\n\n## Usage\n\nAll interaction for the server is done via `mysql::server`. To install the client, use `mysql::client`. To install bindings, use `mysql::bindings`.\n\n### Customize server options\n\nTo define server options, structure a hash structure of overrides in `mysql::server`. This hash resembles a hash in the my.cnf file:\n\n```puppet\n$override_options = {\n  'section' =\u003e {\n    'item' =\u003e 'thing',\n  },\n}\n```\n\nFor options that you would traditionally represent in this format:\n\n```ini\n[section]\nthing = X\n```\n\nEntries can be created as `thing =\u003e true`, `thing =\u003e value`, or `thing =\u003e \"\"` in the hash. Alternatively, you can pass an array as `thing =\u003e ['value', 'value2']` or list each `thing =\u003e value` separately on individual lines.\n\nYou can pass a variable in the hash without setting a value for it; the variable would then use MySQL's default settings. To exclude an option from the `my.cnf` file --- for example, when using `override_options` to revert to a default value --- pass `thing =\u003e undef`.\n\nIf an option needs multiple instances, pass an array. For example,\n\n```puppet\n$override_options = {\n  'mysqld' =\u003e {\n    'replicate-do-db' =\u003e ['base1', 'base2'],\n  },\n}\n```\n\nproduces\n\n```ini\n[mysqld]\nreplicate-do-db = base1\nreplicate-do-db = base2\n```\n\nTo implement version specific parameters, specify the version, such as [mysqld-5.5]. This allows one config for different versions of MySQL.\n\nIf you don’t want to use the default configuration, you can also supply your options to the `$options` parameter instead of `$override_options`.\nPlease note that `$options` and `$override_options` are mutually exclusive, you can only use one of them.\n\nBy default, the puppet won't reload/restart mysqld when you change an existing\nconfiguration. If you want to do that, you can set\n`mysql::server::reload_on_config_change` to true.\n\n### Create a database\n\nTo create a database with a user and some assigned privileges:\n\n```puppet\nmysql::db { 'mydb':\n  user     =\u003e 'myuser',\n  password =\u003e 'mypass',\n  host     =\u003e 'localhost',\n  grant    =\u003e ['SELECT', 'UPDATE'],\n}\n```\n\nTo use a different resource name with exported resources:\n\n```puppet\n @@mysql::db { \"mydb_${fqdn}\":\n  user     =\u003e 'myuser',\n  password =\u003e 'mypass',\n  dbname   =\u003e 'mydb',\n  host     =\u003e ${fqdn},\n  grant    =\u003e ['SELECT', 'UPDATE'],\n  tag      =\u003e $domain,\n}\n```\n\nThen you can collect it on the remote DB server:\n\n```puppet\nMysql::Db \u003c\u003c| tag == $domain |\u003e\u003e\n```\n\nIf you set the sql parameter to a file when creating a database, the file is imported into the new database.\n\nFor large sql files, increase the `import_timeout` parameter, which defaults to 300 seconds.\n\nIf you have installed the mysql client in a non standard bin/sbin path you can set this with `mysql_exec_path` .\n\n```puppet\nmysql::db { 'mydb':\n  user            =\u003e 'myuser',\n  password        =\u003e 'mypass',\n  host            =\u003e 'localhost',\n  grant           =\u003e ['SELECT', 'UPDATE'],\n  sql             =\u003e ['/path/to/sqlfile.gz'],\n  import_cat_cmd  =\u003e 'zcat',\n  import_timeout  =\u003e 900,\n  mysql_exec_path =\u003e '/opt/rh/rh-myql57/root/bin',\n}\n```\n\n### Customize configuration\n\nTo add custom MySQL configuration, place additional files into `includedir`. This allows you to override settings or add additional ones, which is helpful if you don't use `override_options` in `mysql::server`. The `includedir` location is by default set to `/etc/mysql/conf.d`.\n\n### Managing Root Passwords\n\nIf you want the password managed by puppet for `127.0.0.1` and `::1` as an end user you would need to explicitly manage them with additional manifest entries. For example:\n\n```puppet\nmysql_user { '[root@127.0.0.1]':\n  ensure        =\u003e present,\n  password_hash =\u003e mysql::password($mysql::server::root_password),\n}\n\nmysql_user { 'root@::1':\n  ensure        =\u003e present,\n  password_hash =\u003e mysql::password($mysql::server::root_password),\n}\n```\n\n**Note:** This module is not designed to carry out additional DNS and aliasing.\n\n### Work with an existing server\n\nTo instantiate databases and users on an existing MySQL server, you need a `.my.cnf` file in `root`'s home directory. This file must specify the remote server address and credentials. For example:\n\n```ini\n[client]\nuser=root\nhost=localhost\npassword=secret\n```\n\nThis module uses the `mysqld_version` fact to discover the server version being used.  By default, this is set to the output of `mysqld -V`.  If you're working with a remote MySQL server, you may need to set a custom fact for `mysqld_version` to ensure correct behaviour.\n\nWhen working with a remote server, do *not* use the `mysql::server` class in your Puppet manifests.\n\n### Specify passwords\n\nIn addition to passing passwords as plain text, you can input them as hashes. For example:\n\n```puppet\nmysql::db { 'mydb':\n  user     =\u003e 'myuser',\n  password =\u003e '*6C8989366EAF75BB670AD8EA7A7FC1176A95CEF4',\n  host     =\u003e 'localhost',\n  grant    =\u003e ['SELECT', 'UPDATE'],\n}\n```\n\nIf required, the password can also be an empty string to allow connections without an password.\n\n### Create login paths\n\nThis feature works only for the MySQL Community Edition \u003e= 5.6.6.\n\nA login path is a set of options (host, user, password, port and socket) that specify which MySQL server to connect to and which account to authenticate as. The authentication credentials and the other options are stored in an encrypted login file named .mylogin.cnf typically under the users home directory.\n\nMore information about MySQL login paths: https://dev.mysql.com/doc/refman/8.0/en/mysql-config-editor.html.\n\nSome example for login paths:\n\n```puppet\nmysql_login_path { 'client':\n  owner    =\u003e root,\n  host     =\u003e 'localhost',\n  user     =\u003e 'root',\n  password =\u003e Sensitive('secure'),\n  socket   =\u003e '/var/run/mysqld/mysqld.sock',\n  ensure   =\u003e present,\n}\n\nmysql_login_path { 'remote_db':\n  owner    =\u003e root,\n  host     =\u003e '10.0.0.1',\n  user     =\u003e 'network',\n  password =\u003e Sensitive('secure'),\n  port     =\u003e 3306,\n  ensure   =\u003e present,\n}\n```\nSee examples/mysql_login_path.pp for further examples.\n\n### Install Percona server on CentOS\n\nThis example shows how to do a minimal installation of a Percona server on a\nCentOS system. This sets up the Percona server, client, and bindings (including Perl and Python bindings). You can customize this usage and update the version as needed.\n\nThis usage has been tested on Puppet 4.4, 5.5 and 6.3.0 / CentOS 7 / Percona Server 5.7.\n\n**Note:** The installation of the yum repository is not part of this package\nand is here only to show a full example of how you can install.\n\n```puppet\nyumrepo { 'percona':\n  descr    =\u003e 'CentOS $releasever - Percona',\n  baseurl  =\u003e 'http://repo.percona.com/percona/yum/release/$releasever/RPMS/$basearch',\n  gpgkey   =\u003e 'https://repo.percona.com/yum/PERCONA-PACKAGING-KEY',\n  enabled  =\u003e 1,\n  gpgcheck =\u003e 1,\n}\n\nclass { 'mysql::server':\n  package_name     =\u003e 'Percona-Server-server-57',\n  service_name     =\u003e 'mysql',\n  config_file      =\u003e '/etc/my.cnf',\n  includedir       =\u003e '/etc/my.cnf.d',\n  root_password    =\u003e 'PutYourOwnPwdHere',\n  override_options =\u003e {\n    mysqld =\u003e {\n      log-error =\u003e '/var/log/mysqld.log',\n      pid-file  =\u003e '/var/run/mysqld/mysqld.pid',\n    },\n    mysqld_safe =\u003e {\n      log-error =\u003e '/var/log/mysqld.log',\n    },\n  },\n}\n\n# Note: Installing Percona-Server-server-57 also installs Percona-Server-client-57.\n# This shows how to install the Percona MySQL client on its own\nclass { 'mysql::client':\n  package_name =\u003e 'Percona-Server-client-57',\n}\n\n# These packages are normally installed along with Percona-Server-server-57\n# If you needed to install the bindings, however, you could do so with this code\nclass { 'mysql::bindings':\n  client_dev_package_name =\u003e 'Percona-Server-shared-57',\n  client_dev              =\u003e true,\n  daemon_dev_package_name =\u003e 'Percona-Server-devel-57',\n  daemon_dev              =\u003e true,\n  perl_enable             =\u003e true,\n  perl_package_name       =\u003e 'perl-DBD-MySQL',\n  python_enable           =\u003e true,\n  python_package_name     =\u003e 'MySQL-python',\n}\n\n# Dependencies definition\nYumrepo['percona']-\u003e\nClass['mysql::server']\n\nYumrepo['percona']-\u003e\nClass['mysql::client']\n\nYumrepo['percona']-\u003e\nClass['mysql::bindings']\n```\n\n### Install MariaDB on Ubuntu\n\n#### Optional: Install the MariaDB official repo\n\nIn this example, we'll use the latest stable (currently 10.3) from the official MariaDB repository, not the one from the distro repository. You could instead use the package from the Ubuntu repository. Make sure you use the repository corresponding to the version you want.\n\n**Note:** `sfo1.mirrors.digitalocean.com` is one of many mirrors available. You can use any official mirror.\n\n```puppet\ninclude apt\n\napt::source { 'mariadb':\n  location =\u003e 'http://sfo1.mirrors.digitalocean.com/mariadb/repo/10.3/ubuntu',\n  release  =\u003e $::facts['os']['codename'],\n  repos    =\u003e 'main',\n  key      =\u003e {\n    id     =\u003e '177F4010FE56CA3336300305F1656F24C74CD1D8',\n    server =\u003e 'hkp://keyserver.ubuntu.com:80',\n  },\n  include =\u003e {\n    src   =\u003e false,\n    deb   =\u003e true,\n  },\n}\n```\n\n#### Install the MariaDB server\n\nThis example shows MariaDB server installation on Ubuntu Xenial. Adjust the version and the parameters of `my.cnf` as needed. All parameters of the `my.cnf` can be defined using the `override_options` parameter.\n\nThe folders `/var/log/mysql` and `/var/run/mysqld` are created automatically, but if you are using other custom folders, they should exist as prerequisites for this code.\n\nAll the values set here are an example of a working minimal configuration.\n\nSpecify the version of the package you want with the `package_ensure` parameter.\n\n```puppet\nclass { 'mysql::server':\n  package_name     =\u003e 'mariadb-server',\n  package_ensure   =\u003e '1:10.3.21+maria~xenial',\n  service_name     =\u003e 'mysqld',\n  root_password    =\u003e 'AVeryStrongPasswordUShouldEncrypt!',\n  override_options =\u003e {\n    mysqld =\u003e {\n      'log-error' =\u003e '/var/log/mysql/mariadb.log',\n      'pid-file'  =\u003e '/var/run/mysqld/mysqld.pid',\n    },\n    mysqld_safe =\u003e {\n      'log-error' =\u003e '/var/log/mysql/mariadb.log',\n    },\n  },\n}\n\n# Dependency management. Only use that part if you are installing the repository\n# as shown in the Preliminary step of this example.\nApt::Source['mariadb'] ~\u003e\nClass['apt::update'] -\u003e\nClass['mysql::server']\n\n```\n\n#### Install the MariaDB client\n\nThis example shows how to install the MariaDB client and all of the bindings at once. You can do this installation separately from the server installation.\n\nSpecify the version of the package you want with the `package_ensure` parameter.\n\n```puppet\nclass { 'mysql::client':\n  package_name    =\u003e 'mariadb-client',\n  package_ensure  =\u003e '1:10.3.21+maria~xenial',\n  bindings_enable =\u003e true,\n}\n\n# Dependency management. Only use that part if you are installing the repository as shown in the Preliminary step of this example.\nApt::Source['mariadb'] ~\u003e\nClass['apt::update'] -\u003e\nClass['mysql::client']\n```\n\n### Install MySQL Community server on CentOS\n\nYou can install MySQL Community Server on CentOS using the mysql module and Hiera. This example was tested with the following versions:\n\n* MySQL Community Server 5.6\n* Centos 7.3\n* Puppet 3.8.7 using Hiera\n* puppetlabs-mysql module v3.9.0\n\nIn Puppet:\n\n```puppet\ninclude mysql::server\n\ncreate_resources(yumrepo, hiera('yumrepo', {}))\n\nYumrepo['repo.mysql.com'] -\u003e Anchor['mysql::server::start']\nYumrepo['repo.mysql.com'] -\u003e Package['mysql_client']\n\ncreate_resources(mysql::db, hiera('mysql::server::db', {}))\n```\n\nIn Hiera:\n\n```yaml\n---\n\n# Centos 7.3\nyumrepo:\n  'repo.mysql.com':\n    baseurl: \"http://repo.mysql.com/yum/mysql-5.6-community/el/%{::operatingsystemmajrelease}/$basearch/\"\n    descr: 'repo.mysql.com'\n    enabled: 1\n    gpgcheck: true\n    gpgkey: 'http://repo.mysql.com/RPM-GPG-KEY-mysql'\n\nmysql::client::package_name: \"mysql-community-client\" # required for proper MySQL installation\nmysql::server::package_name: \"mysql-community-server\" # required for proper MySQL installation\nmysql::server::package_ensure: 'installed' # do not specify version here, unfortunately yum fails with error that package is already installed\nmysql::server::root_password: \"change_me_i_am_insecure\"\nmysql::server::manage_config_file: true\nmysql::server::service_name: 'mysqld' # required for puppet module\nmysql::server::override_options:\n  'mysqld':\n    'bind-address': '127.0.0.1'\n    'log-error': '/var/log/mysqld.log' # required for proper MySQL installation\n  'mysqld_safe':\n    'log-error': '/var/log/mysqld.log'  # required for proper MySQL installation\n\n# create database + account with access, passwords are not encrypted\nmysql::server::db:\n  \"dev\":\n    user: \"dev\"\n    password: \"devpass\"\n    host: \"127.0.0.1\"\n    grant:\n      - \"ALL\"\n\n```\n\n### Install Plugins\n\nPlugins can be installed by using the `mysql_plugin` defined type. See `examples/mysql_plugin.pp` for futher examples.\n\n### Use Percona XtraBackup\n\nThis example shows how to configure MySQL backups with Percona XtraBackup. This sets up a weekly cronjob to perform a full backup and additional daily cronjobs for incremental backups. Each backup will create a new directory. A cleanup job will automatically remove backups that are older than 15 days.\n\n```puppet\nyumrepo { 'percona':\n  descr    =\u003e 'CentOS $releasever - Percona',\n  baseurl  =\u003e 'http://repo.percona.com/release/$releasever/RPMS/$basearch',\n  gpgkey   =\u003e 'https://www.percona.com/downloads/RPM-GPG-KEY-percona https://repo.percona.com/yum/PERCONA-PACKAGING-KEY',\n  enabled  =\u003e 1,\n  gpgcheck =\u003e 1,\n}\n\nclass { 'mysql::server::backup':\n  backupuser        =\u003e 'myuser',\n  backuppassword    =\u003e 'mypassword',\n  backupdir         =\u003e '/tmp/backups',\n  provider          =\u003e 'xtrabackup',\n  backuprotate      =\u003e 15,\n  execpath          =\u003e '/usr/local/bin:/usr/local/sbin:/usr/bin:/usr/sbin:/bin:/sbin',\n  time              =\u003e ['23', '15'],\n}\n```\n\nIf the daily or weekly backup was successful, then the empty file `/tmp/mysqlbackup_success` is created, which makes it easy to monitor the status of the database backup.\n\nAfter two weeks the backup directory should look similar to the example below.\n\n```\n/tmp/backups/2019-11-10_full\n/tmp/backups/2019-11-11_23-15-01\n/tmp/backups/2019-11-13_23-15-01\n/tmp/backups/2019-11-13_23-15-02\n/tmp/backups/2019-11-14_23-15-01\n/tmp/backups/2019-11-15_23-15-02\n/tmp/backups/2019-11-16_23-15-01\n/tmp/backups/2019-11-17_full\n/tmp/backups/2019-11-18_23-15-01\n/tmp/backups/2019-11-19_23-15-01\n/tmp/backups/2019-11-20_23-15-02\n/tmp/backups/2019-11-21_23-15-01\n/tmp/backups/2019-11-22_23-15-02\n/tmp/backups/2019-11-23_23-15-01\n```\n\nA drawback of using incremental backups is the need to keep at least 7 days of backups, otherwise the full backups is removed early and consecutive incremental backups will fail. Furthermore an incremental backups becomes obsolete once the required full backup was removed.\n\nThe next example uses XtraBackup with incremental backups disabled. In this case the daily cronjob will always perform a full backup.\n\n```puppet\nclass { 'mysql::server::backup':\n  backupuser          =\u003e 'myuser',\n  backuppassword      =\u003e 'mypassword',\n  backupdir           =\u003e '/tmp/backups',\n  provider            =\u003e 'xtrabackup',\n  incremental_backups =\u003e false,\n  backuprotate        =\u003e 5,\n  execpath            =\u003e '/usr/local/bin:/usr/local/sbin:/usr/bin:/usr/sbin:/bin:/sbin',\n  time                =\u003e ['23', '15'],\n}\n```\n\nThe next example shows how to use mariabackup (a fork of xtrabackup) as a backup provider.\nNote that on most Linux/BSD distributions, this will require setting `backupmethod_package =\u003e 'mariadb-backup'` in the `mysql::server::backup` declaration in order to override the default xtrabackup package (`percona-xtrabackup`).\n\n```puppet\nclass { 'mysql::server':\n  package_name            =\u003e 'mariadb-server',\n  package_ensure          =\u003e '1:10.3.21+maria~xenial',\n  service_name            =\u003e 'mysqld',\n  root_password           =\u003e 'AVeryStrongPasswordUShouldEncrypt!',\n}\n\nclass { 'mysql::server::backup':\n  backupuser              =\u003e 'mariabackup',\n  backuppassword          =\u003e 'AVeryStrongPasswordUShouldEncrypt!',\n  provider                =\u003e 'xtrabackup',\n  backupmethod            =\u003e 'mariabackup',\n  backupmethod_package    =\u003e 'mariadb-backup',\n  backupdir               =\u003e '/tmp/backups',\n  backuprotate            =\u003e 15,\n  execpath                =\u003e '/usr/local/bin:/usr/local/sbin:/usr/bin:/usr/sbin:/bin:/sbin',\n  time                    =\u003e ['23', '15'],\n}\n```\n\n## Reference\n\n### Classes\n\n#### Public classes\n\n* [`mysql::server`](#mysqlserver): Installs and configures MySQL.\n* [`mysql::server::backup`](#mysqlserverbackup): Sets up MySQL backups via cron.\n* [`mysql::bindings`](#mysqlbindings): Installs various MySQL language bindings.\n* [`mysql::client`](#mysqlclient): Installs MySQL client (for non-servers).\n\n#### Private classes\n\n* `mysql::server::install`: Installs packages.\n* `mysql::server::installdb`: Implements setup of mysqld data directory (e.g. /var/lib/mysql)\n* `mysql::server::config`: Configures MYSQL.\n* `mysql::server::service`: Manages service.\n* `mysql::server::account_security`: Deletes default MySQL accounts.\n* `mysql::server::root_password`: Sets MySQL root password.\n* `mysql::server::providers`: Creates users, grants, and databases.\n* `mysql::bindings::client_dev`: Installs MySQL client development package.\n* `mysql::bindings::daemon_dev`: Installs MySQL daemon development package.\n* `mysql::bindings::java`: Installs Java bindings.\n* `mysql::bindings::perl`: Installs Perl bindings.\n* `mysql::bindings::php`: Installs PHP bindings.\n* `mysql::bindings::python`: Installs Python bindings.\n* `mysql::bindings::ruby`: Installs Ruby bindings.\n* `mysql::client::install`:  Installs MySQL client.\n* `mysql::backup::mysqldump`: Implements mysqldump backups.\n* `mysql::backup::mysqlbackup`: Implements backups with Oracle MySQL Enterprise Backup.\n* `mysql::backup::xtrabackup`: Implements backups with XtraBackup from Percona or Mariabackup.\n\n### Parameters\n\n#### mysql::server\n\n##### `create_root_user`\n\nWhether root user should be created.\n\nValid values are `true`, `false`.\n\nDefaults to `true`.\n\nThis is useful for a cluster setup with Galera. The root user has to be created only once. You can set this parameter true on one node and set it to false on the remaining nodes.\n\n#####  `create_root_my_cnf`\n\nWhether to create `/root/.my.cnf`.\n\nValid values are `true`, `false`.\n\nDefaults to `true`.\n\n`create_root_my_cnf` allows creation of `/root/.my.cnf` independently of `create_root_user`. You can use this for a cluster setup with Galera where you want `/root/.my.cnf` to exist on all nodes.\n\n#####  `root_password`\n\nThe MySQL root password. Puppet attempts to set the root password and update `/root/.my.cnf` with it.\n\nThis is required if `create_root_user` or `create_root_my_cnf` are true. If `root_password` is 'UNSET', then `create_root_user` and `create_root_my_cnf` are assumed to be false --- that is, the MySQL root user and `/root/.my.cnf` are not created.\n\nPassword changes are supported; however, the old password must be set in `/root/.my.cnf`. Effectively, Puppet uses the old password, configured in `/root/my.cnf`, to set the new password in MySQL, and then updates `/root/.my.cnf` with the new password.\n\n##### `old_root_password`\n\nThis parameter no longer does anything. It exists only for backwards compatibility. See the `root_password` parameter above for details on changing the root password.\n\n#####  `create_root_login_file`\n\nWhether to create `/root/.mylogin.cnf` when using mysql 5.6.6+.\n\nValid values are `true`, `false`.\n\nDefaults to `false`.\n\n`create_root_login_file` will put a copy of your existing `.mylogin.cnf` in the  `/root/.mylogin.cnf` location.\n\nWhen set to 'true', this option also requires the `login_file` option.\n\nThe `login_file` option is required when set to true.\n\n#### `login_file`\n\nWhether to put the `/root/.mylogin.cnf` in place.\n\nYou need to create the `.mylogin.cnf` file with `mysql_config_editor`, this tool comes with mysql 5.6.6+.\n\nThe created .mylogin.cnf needs to be put under files in your module, see example below on how to use this.\n\nWhen the `/root/.mylogin.cnf` exists the environment variable `MYSQL_TEST_LOGIN_FILE` will be set.\n\nThis is required if `create_root_user` and `create_root_login_file` are true. If `root_password` is 'UNSET', then `create_root_user` and `create_root_login_file` are assumed to be false --- that is, the MySQL root user and `/root/.mylogin.cnf` are not created.\n\n```puppet\nclass { 'mysql::server':\n  root_password          =\u003e 'password',\n  create_root_my_cnf     =\u003e false,\n  create_root_login_file =\u003e true,\n  login_file             =\u003e 'puppet:///modules/${module_name}/mylogin.cnf',\n}\n```\n\n##### `override_options`\n\nSpecifies override options to pass into MySQL. Structured like a hash in the my.cnf file:\n\n```puppet\nclass { 'mysql::server':\n  root_password =\u003e 'password'\n}\n\nmysql_plugin { 'auth_pam':\n  ensure =\u003e present,\n  soname =\u003e 'auth_pam.so',\n}\n\n```\n\n### Tasks\n\nThe MySQL module has an example task that allows a user to execute arbitary SQL against a database. Please refer to to the [PE documentation](https://puppet.com/docs/pe/2017.3/orchestrator/running_tasks.html) or [Bolt documentation](https://puppet.com/docs/bolt/latest/bolt.html) on how to execute a task.\n\n## Limitations\n\nThis module lacks compatibility with the ARM architecture, for an extensive list of supported operating systems, see [metadata.json](https://github.com/puppetlabs/puppetlabs-mysql/blob/main/metadata.json)\n\n**Note:** The mysqlbackup.sh does not work and is not supported on MySQL 5.7 and greater.\n\n## License\n\nThis codebase is licensed under the Apache2.0 licensing, however due to the nature of the codebase the open source dependencies may also use a combination of [AGPL](https://opensource.org/license/agpl-v3/), [BSD-2](https://opensource.org/license/bsd-2-clause/), [BSD-3](https://opensource.org/license/bsd-3-clause/), [GPL2.0](https://opensource.org/license/gpl-2-0/), [LGPL](https://opensource.org/license/lgpl-3-0/), [MIT](https://opensource.org/license/mit/) and [MPL](https://opensource.org/license/mpl-2-0/) Licensing.\n\n## Development\n\nWe are experimenting with a new tool for running acceptance tests. Its name is [puppet_litmus](https://github.com/puppetlabs/puppet_litmus) this replaces beaker as the test runner. To run the acceptance tests follow the [instructions](https://puppetlabs.github.io/litmus/Running-acceptance-tests.html) from the Litmus documentation.\n\nPuppet modules on the Puppet Forge are open projects, and community contributions are essential for keeping them great. We can't access the huge number of platforms and myriad of hardware, software, and deployment configurations that Puppet is intended to serve.\n\nWe want to keep it as easy as possible to contribute changes so that our modules work in your environment. There are a few guidelines that we need contributors to follow so that we can have a chance of keeping on top of things.\n\nCheck out our the complete [module contribution guide](https://puppet.com/docs/puppet/latest/contributing.html).\n\n### Authors\n\nThis module is based on work by David Schmitt. Thank you to all of our [contributors](https://github.com/puppetlabs/puppetlabs-mysql/graphs/contributors).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpuppetlabs%2Fpuppetlabs-mysql","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpuppetlabs%2Fpuppetlabs-mysql","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpuppetlabs%2Fpuppetlabs-mysql/lists"}