簡體   English   中英

Rails db:創建整理錯誤

[英]Rails db:create collation error

運行rake db:create時出現問題:

[root@zephyrnode /domain/rails/testapp ]# rake db:create --trace
(in /domain/rails/testapp)
** Invoke db:create (first_time)
** Invoke db:load_config (first_time)
** Invoke rails_env (first_time)
** Execute rails_env
** Execute db:load_config
** Execute db:create
Couldn't create database for {"adapter"=>"mysql", "encoding"=>"utf8", "collation"=>"utf8_bin", "reconnect"=>false, "database"=>"testapp_development", "pool"=>5, "username"=>"root", "password"=>"rootpass", "socket"=>"/var/run/mysqld/mysqld.sock", "host"=>"127.0.0.1"}, charset: utf8, collation: utf8_bin (if you set the charset manually, make sure you have a matching collation)

我已經在下面附上了所有可能的版本和設置信息。 我已經嘗試了所有在Google上找到的解決方案,但沒有運氣。 有沒有人有任何解決方案或建議? 謝謝!

[root@zephyrnode /domain/rails/testapp ]# mysql --version
mysql  Ver 14.14 Distrib 5.1.38, for unknown-linux-gnu (x86_64) using  EditLine wrapper

mysql> show variables like "character_set_database";
+------------------------+-------+
| Variable_name          | Value |
+------------------------+-------+
| character_set_database | utf8  |
+------------------------+-------+
1 row in set (0.00 sec)

mysql> show variables like "collation_database";
+--------------------+----------+
| Variable_name      | Value    |
+--------------------+----------+
| collation_database | utf8_bin |
+--------------------+----------+
1 row in set (0.00 sec)

[root@zephyrnode /domain/rails/testapp ]# ruby -v
ruby 1.9.1p243 (2009-07-16 revision 24175) [x86_64-linux]

[root@zephyrnode /domain/rails/testapp ]# rails -v
Rails 2.3.4

[root@zephyrnode /domain/rails/testapp ]# gem -v
1.3.5

[root@zephyrnode /domain/rails/testapp ]# gem list

*** LOCAL GEMS ***

actionmailer (2.3.4)
actionpack (2.3.4)
activerecord (2.3.4)
activeresource (2.3.4)
activesupport (2.3.4)
cgi_multipart_eof_fix (2.5.0)
daemons (1.0.10)
fastthread (1.0.7)
gem_plugin (0.2.3)
mysql (2.8.1)
rack (1.0.0)
rails (2.3.4)
rake (0.8.7)
rubygems-update (1.3.5)

我的database.yml:

development:
  adapter: mysql
  encoding: utf8
  collation: utf8_bin
  reconnect: false
  database: testapp_development
  pool: 5
  username: root
  password: rootpass
  socket: /var/run/mysqld/mysqld.sock
  host: 127.0.0.1

您是否嘗試過不指定排序規則? 我使用utf8為我的MySQL數據庫指定編碼而不是歸類,它可以正常工作。

將database.yml文件中的排序規則行更改為以下任何show variables like "collation_server";

然后嘗試rake RAILS_ENV=development db:create

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM