Change default collation to utf8_general_ci

There can be issues during database migrations when a column used as a
foreign key is using a different collation between the parent and
child table.

Update the my.cnf template to set the server default collation to
utf8_general_ci to ensure consistency between tables initially
created with and those later altered to use the utf8 character set.

This matches both the instruction from the OpenStack install guide[0],
and MariaDB's default for the utf8 character set[1].

[0]
http://docs.openstack.org/mitaka/install-guide-ubuntu/environment-sql-database.html
[1]
>  SHOW CHARACTER SET WHERE CHARSET = 'utf8';
+---------+---------------+-------------------+--------+
| Charset | Description   | Default collation | Maxlen |
+---------+---------------+-------------------+--------+
| utf8    | UTF-8 Unicode | utf8_general_ci   |      3 |
+---------+---------------+-------------------+--------+

Related-Bug: 1594195
Change-Id: I8507b6c9bd058bb308cc089f3802e52e24bea324
This commit is contained in:
Jimmy McCrory 2016-06-20 10:43:23 -07:00
parent d99e16da7c
commit ac3942da3d
2 changed files with 6 additions and 1 deletions

View File

@ -0,0 +1,5 @@
---
upgrade:
- The default database collation has changed from
`utf8_unicode_ci` to `utf8_general_ci`. Existing
databases and tables will need to be converted.

View File

@ -24,7 +24,7 @@ default-character-set = utf8
[mysqld]
user = mysql
collation-server = utf8_unicode_ci
collation-server = utf8_general_ci
init-connect = 'SET NAMES utf8'
character-set-server = utf8
datadir = /var/lib/mysql