@@ -320,6 +320,67 @@ Class['apt::update'] ->
320
320
Class['::mysql::client']
321
321
```
322
322
323
+ ### Install MySQL Community server on CentOS
324
+
325
+ You can install MySQL Community Server on CentOS using the mysql module and Hiera. This example was tested with the following versions:
326
+
327
+ * MySQL Community Server 5.6
328
+ * Centos 7.3
329
+ * Puppet 3.8.7 using hiera
330
+ * puppetlabs-mysql module v3.9.0
331
+
332
+ In Puppet:
333
+
334
+ ``` puppet
335
+ include ::mysql::server
336
+
337
+ create_resources(yumrepo, hiera('yumrepo', {}))
338
+
339
+ Yumrepo['repo.mysql.com'] -> Anchor['mysql::server::start']
340
+ Yumrepo['repo.mysql.com'] -> Package['mysql_client']
341
+
342
+ create_resources(mysql::db, hiera('mysql::server::db', {}))
343
+ ```
344
+
345
+ In Hiera:
346
+
347
+ ``` yaml
348
+ ---
349
+ # mysql module requires feeding it a bunch of parameters to properly install MySQL, instead of MariaDB
350
+ # Centos 7.3
351
+ yumrepo :
352
+ ' repo.mysql.com ' :
353
+ baseurl : " http://repo.mysql.com/yum/mysql-5.6-community/el/%{::operatingsystemmajrelease}/$basearch/"
354
+ descr : ' repo.mysql.com'
355
+ enabled : 1
356
+ gpgcheck : true
357
+ gpgkey : ' http://repo.mysql.com/RPM-GPG-KEY-mysql'
358
+
359
+ mysql::client::package_name : " mysql-community-client" # required for proper MySQL installation
360
+ mysql::server::package_name : " mysql-community-server" # required for proper MySQL installation
361
+ mysql::server::package_ensure : ' installed' # do not specify version here, unfortunately yum fails with error that package is already installed
362
+ mysql::server::root_password : " change_me_i_am_insecure"
363
+ mysql::server::manage_config_file : true
364
+ mysql::server::service_name : ' mysqld' # required for puppet module
365
+ mysql::server::override_options :
366
+ ' mysqld ' :
367
+ ' bind-address ' : ' 127.0.0.1'
368
+ ' log-error ' : /var/log/mysqld.log' # required for proper MySQL installation
369
+ ' mysqld_safe ' :
370
+ ' log-error ' : ' /var/log/mysqld.log' # required for proper MySQL installation
371
+
372
+ # create database + account with access, passwords are not encrypted
373
+ mysql::server::db :
374
+ " dev " :
375
+ user : " dev"
376
+ password : " devpass"
377
+ host : " 127.0.0.1"
378
+ grant :
379
+ - " ALL"
380
+
381
+ ```
382
+
383
+
323
384
## Reference
324
385
325
386
### Classes
0 commit comments