Implement character_set. You can change the default server and

client character set
This commit is contained in:
Lebedev Vadim 2013-04-04 14:02:58 +04:00
parent 8000041e9f
commit e3b6de2da2
2 changed files with 14 additions and 5 deletions

View file

@ -19,6 +19,8 @@
# [*default_engine] - configure a default table engine # [*default_engine] - configure a default table engine
# [*root_group] - use specified group for root-owned files # [*root_group] - use specified group for root-owned files
# [*restart] - whether to restart mysqld (true/false) # [*restart] - whether to restart mysqld (true/false)
# [*character-set] - You can change the default server and
# client character set
# #
# Actions: # Actions:
# #
@ -52,15 +54,16 @@ class mysql::config(
$default_engine = 'UNSET', $default_engine = 'UNSET',
$root_group = $mysql::params::root_group, $root_group = $mysql::params::root_group,
$restart = $mysql::params::restart, $restart = $mysql::params::restart,
$purge_conf_dir = false $purge_conf_dir = false,
$character_set = 'UNSET',
) inherits mysql::params { ) inherits mysql::params {
File { File {
owner => 'root', owner => 'root',
group => $root_group, group => $root_group,
mode => '0400', mode => '0400',
notify => $restart ? { notify => $restart ? {
true => Exec['mysqld-restart'], true => Exec['mysqld-restart'],
false => undef, false => undef,
}, },
} }
@ -100,7 +103,7 @@ class mysql::config(
unless => "mysqladmin -u root -p'${root_password}' status > /dev/null", unless => "mysqladmin -u root -p'${root_password}' status > /dev/null",
path => '/usr/local/sbin:/usr/bin:/usr/local/bin', path => '/usr/local/sbin:/usr/bin:/usr/local/bin',
notify => $restart ? { notify => $restart ? {
true => Exec['mysqld-restart'], true => Exec['mysqld-restart'],
false => undef, false => undef,
}, },
require => File['/etc/mysql/conf.d'], require => File['/etc/mysql/conf.d'],

View file

@ -1,6 +1,9 @@
[client] [client]
port = <%= port %> port = <%= port %>
socket = <%= socket %> socket = <%= socket %>
<% if character_set != 'UNSET' %>
default-character-set = <%= character_set %>
<% end -%>
[mysqld_safe] [mysqld_safe]
socket = <%= socket %> socket = <%= socket %>
nice = 0 nice = 0
@ -36,6 +39,9 @@ max_binlog_size = 100M
<% if default_engine != 'UNSET' %> <% if default_engine != 'UNSET' %>
default-storage-engine = <%= default_engine %> default-storage-engine = <%= default_engine %>
<% end %> <% end %>
<% if character_set != 'UNSET' %>
character-set-server = <%= character_set %>
<% end %>
<% if ssl == true %> <% if ssl == true %>
ssl-ca = <%= ssl_ca %> ssl-ca = <%= ssl_ca %>
ssl-cert = <%= ssl_cert %> ssl-cert = <%= ssl_cert %>