rake db:create无法初始化字符集utf8mb4

时间:2015-03-04 12:16:12

标签: mysql

我在CentOS 6.5服务器下运行的sinatra应用程序。当我运行"rake db:create RACK_ENV=production"时,我收到错误:

Character set 'utf8mb4' is not a compiled character set 
and is not specified in the '/usr/share/mysql/charsets/Index.xml' file

我的数据库配置:

ActiveRecord::Base.configurations[:production] = {
  :adapter   => 'mysql2',
  :encoding  => 'utf8mb4',
  ...

我已经更改了mysql my.conf,仍然出错。

[client]
default-character-set = utf8mb4

[mysql]
default-character-set = utf8mb4

[mysqld]
character-set-client-handshake = FALSE
character-set-server = utf8mb4
collation-server = utf8mb4_general_ci

这是在mysql shell中:

mysql> SHOW VARIABLES WHERE Variable_name LIKE 'character\_set\_%' OR Variable_name LIKE 'collation%';
+--------------------------+--------------------+
| Variable_name            | Value              |
+--------------------------+--------------------+
| character_set_client     | utf8mb4            |
| character_set_connection | utf8mb4            |
| character_set_database   | utf8mb4            |
| character_set_filesystem | binary             |
| character_set_results    | utf8mb4            |
| character_set_server     | utf8mb4            |
| character_set_system     | utf8               |
| collation_connection     | utf8mb4_general_ci |
| collation_database       | utf8mb4_general_ci |
| collation_server         | utf8mb4_general_ci |
+--------------------------+--------------------+
10 rows in set (0.00 sec)

mysql> 

Mysql版本:

Server version: 5.6.23 MySQL Community Server (GPL)

有任何帮助吗?谢谢!

0 个答案:

没有答案