简体   繁体   English

rake db:create - 整理问题

[英]rake db:create - collation issues

kratos-iii:railsproj zachinglis$ rake db:create
(in /Users/zachinglis/Sites/rails/railsproj)
Couldn't create database for {"adapter"=>"mysql", "host"=>"localhost", "username"=>"root", "password"=>nil, "database"=>"railsproj_development"}, charset: utf8, collation: utf8_general_ci (if you set the charset manually, make sure you have a matching collation)

I had no issues using Sequel Pro and even creating said database. 我没有使用Sequel Pro甚至创建所述数据库的问题。

How do I resolve this? 我该如何解决这个问题? Having an empty password never gave me issues before. 有一个空密码从来没有给我带来问题。 And I really doubt thats it. 我真的很怀疑它。

I was having the same problem than you, me and my friends were all going mad because of it, until we've found this link http://weblog.rubyonrails.org/2009/8/30/upgrading-to-snow-leopard 我遇到了与你相同的问题,我和我的朋友都因此而生气,直到我们找到了这个链接http://weblog.rubyonrails.org/2009/8/30/upgrading-to-snow-豹

I've just followed the mysql installation steps and it worked great here :] 我刚刚遵循了mysql的安装步骤,它在这里工作得很好:]

I happened on same problem after installing new database server MySQL5.0 to 5.1. 安装新的数据库服务器MySQL5.0到5.1后,我遇到了同样的问题。 If you have installed new db-server, Your mysql gem library is not suitable for your database server. 如果您安装了新的db-server,则您的mysql gem库不适合您的数据库服务器。 You may solve this by reinstall mysql gem lib. 你可以通过重新安装mysql gem lib来解决这个问题。

 sudo env ARCHFLAGS="-arch i386" gem install mysql -- --with-mysql-config=/your/mysql_config

Re-install mysql-server and mysql-client using this command: 使用以下命令重新安装mysql-server和mysql-client:

sudo apt-get install mysql-server mysql-client

and then some libraries you need to install to make MySQL available to ruby: 然后你需要安装一些库来使Ruby可用于ruby:

sudo apt-get install libmysql-ruby

This all solved my problem. 这一切都解决了我的问题。 Try it !!! 试试吧 !!! :) :)

I just encountered this as well on a fresh Snow Leopard install. 我刚刚在新的Snow Leopard安装上遇到过这个问题。

I had another project that created the databases without issue, but my primary project would give the errors you described. 我有另一个项目创建数据库没有问题,但我的主项目会给你描述的错误。 After poking around, the only difference was the former specified a socket, whereas the failing project (and yours too) uses a host. 在探索之后,唯一的区别是前者指定了一个套接字,而失败的项目(以及你的)也使用了一个主机。

That is to say, this database.yml causes the problem: 也就是说,这个database.yml导致了这个问题:

development:
  adapter: mysql
  database: fanvsfan_development
  username: root
  password:
  host: localhost

But this works: 但这有效:

development:
  adapter: mysql
  database: fanvsfan_development
  username: root
  password:
  socket: /tmp/mysql.sock

I'm unsure what the actual difference is, but this seems like a workaround. 我不确定实际差异是什么,但这似乎是一种解决方法。

Using RVM? 使用RVM? Do this for Rails v 2.3 为Rails v 2.3做这个

export ARCHFLAGS="-arch x86_64" ; gem install --no-rdoc --no-ri mysql -v 2.7 -- --with-mysql-dir=/usr/local --with-mysql-config=/usr/local/mysql/bin/mysql_config

This is a good reference. 这是一个很好的参考。 And I got if fixed through this http://www.ultrasaurus.com/sarahblog/2008/12/getting-started-with-rails-2-day-1/ 如果通过这个http://www.ultrasaurus.com/sarahblog/2008/12/getting-started-with-rails-2-day-1/修复了

Does the database already exist? 数据库是否已存在? Is MySQL setup and running? MySQL是否已设置并正在运行? What changed? 改变了什么? (OS Upgrade maybe)? (操作系统升级可能)? Does a fresh rails app work? 新的rails应用程序是否有效? What about your other environments (test, production)? 你的其他环境(测试,生产)怎么样?

Is there a back trace? 有背影吗? you could post (use rake --trace db:create). 你可以发帖(使用rake --trace db:create)。 Usually MySQL is returns a very explicit error message, rake is just eating it. 通常MySQL会返回一个非常明确的错误消息,rake只是吃了它。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM