Mercurial > repos > other > Puppet
view modules/website/manifests/mysql.pp @ 4:894e6287926f
Fix "slow query" log - previously MySQL didn't have permission to write it
author | IBBoard <dev@ibboard.co.uk> |
---|---|
date | Wed, 27 Aug 2014 13:46:07 +0000 |
parents | b0a6f4b93e10 |
children | f2056be70cb8 |
line wrap: on
line source
class website::mysql ( $mysqluser, $mysqlpassword, $mysqlsuffix = '', $phpsuffix = '', $phpmysqlsuffix = '') { class { 'mysql::client': package_name => "mysql${mysqlsuffix}", bindings_enable => false, #Deal with bindings manually } class { 'mysql::bindings': php_enable => true, php_package_name => "php${phpsuffix}-mysql${phpmysqlsuffix}", } class { 'mysql::server': package_name => "mysql${mysqlsuffix}-server", override_options => { 'mysqld' => { 'query_cache_size' => '32M', 'join_buffer_size' => '262144', #256K 'tmp_table_size' => '48M', 'max_heap_table_size' => '48M', 'table_open_cache' => '500', 'slow_query_log' => '1', 'slow_query_log_file' => '/var/log/mysql/slow-query.log', } }, require => File['/var/log/mysql/'] } file { '/var/log/mysql': ensure => directory, owner => 'mysql', group => 'mysql', } $username = strip($mysqluser) $password = strip($mysqlpassword) $configured_marker = '/etc/mysql/.is-configured' exec { 'Rename root MySQL user for security': command => "mysql -uroot -e 'UPDATE mysql.user SET User = \"$username\", Password = PASSWORD(\"$password\") WHERE User = \"root\"; DELETE FROM mysql.user WHERE User = ''; FLUSH PRIVILEGES;' && touch $configured_marker", provider => shell, creates => $configured_marker } }