适配器:mysql2到适配器:mysql的区别?

时间:2015-03-05 09:43:54

标签: mysql ruby sinatra

在我的CentOS 6.5系统上创建数据库时,我收到了这个错误:

 [william@qwe current]$ bundle exec rake db:create RACK_ENV=production --trace
    ** Invoke db:create (first_time)
    ** Invoke db:load_config (first_time)
    ** Execute db:load_config
    "-----------------Redis.rb"
    ** Execute db:create
    Character set 'utf8mb4' is not a compiled character set and is not specified in the '/usr/share/mysql/charsets/Index.xml' file
    Couldn't create database for {"database"=>"fsproduction", "encoding"=>"utf8mb4", "adapter"=>"mysql2", "username"=>"root", "password"=>"123", "host"=>"localhost", "pool"=>5, "timeout"=>5000, "socket"=>"/var/lib/mysql/mysql.sock"}, {:charset=>"utf8mb4"}
    (If you set the charset manually, make sure you have a matching collation)

这是我的database.yml。但我将adapter: mysql2更改为adapter: mysql它的工作原理。

production:
  database: fsproduction
  encoding: utf8mb4
  adapter: mysql2
  username: root
  password: '123'
  host: localhost
  pool: 5
  timeout: 5000
  socket: /var/lib/mysql/mysql.sock

任何线索,谢谢!! --------的更新 -------------

adapter: mysql2adapter: mysql的区别是什么?

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)

0 个答案:

没有答案