Make mysql clients assume utf8 character encoding

Set the character encoding to utf8 for all mysql clients that run
on the gerrit server. This ensures that Gerrit maintenance activities:
mysqldump, mysql, etc.. use the correct character encoding when run locally
on the Gerrit servers.

Change-Id: I47b64ac4dd8b9a21250ff836a4dc88b41a035eeb
This commit is contained in:
Khai Do 2015-03-13 09:53:48 -07:00
parent 2655c32cbc
commit 438d43a542
3 changed files with 40 additions and 1 deletions

25
files/my.cnf Normal file
View File

@ -0,0 +1,25 @@
#
# The MySQL database server configuration file.
#
# You can copy this to one of:
# - "/etc/mysql/my.cnf" to set global options,
# - "~/.my.cnf" to set user-specific options.
#
# One can use all long options that the program supports.
# Run program with --help to get a list of available options and with
# --print-defaults to see which it would actually understand and use.
#
# For explanations see
# http://dev.mysql.com/doc/mysql/en/server-system-variables.html
# This will be passed to all mysql clients
# It has been reported that passwords should be enclosed with ticks/quotes
# escpecially if they contain "#" chars...
# Remember to edit /etc/mysql/debian.cnf when changing the socket location.
[client]
port = 3306
socket = /var/run/mysqld/mysqld.sock
# Make clients assume UTF-8 encoding
character_set_server = utf8

View File

@ -640,6 +640,20 @@ class gerrit(
],
}
package { 'mysql-client':
ensure => present,
}
# Add config to make clients assume UTF-8 encoding
file { '/etc/mysql/conf.d/client.conf':
ensure => present,
source => 'puppet:///modules/gerrit/my.cnf',
replace => true,
owner => 'root',
group => 'root',
mode => '0644',
require => Package['mysql-client'],
}
package { 'libbcprov-java':
ensure => present,
}

View File

@ -21,7 +21,7 @@ class gerrit::mysql(
password => $database_password,
host => 'localhost',
grant => ['all'],
charset => 'latin1',
charset => 'utf8',
require => [
Class['mysql::server'],
Class['mysql::server::account_security'],