rake db:create - collation issues

前端 未结 7 2061
逝去的感伤
逝去的感伤 2020-12-10 18:07
kratos-iii:railsproj zachinglis$ rake db:create
(in /Users/zachinglis/Sites/rails/railsproj)
Couldn\'t create database for {\"adapter\"=>\"mysql\", \"host\"=>\         


        
相关标签:
7条回答
  • 2020-12-10 18:48

    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/

    0 讨论(0)
  • 2020-12-10 18:53

    Re-install mysql-server and mysql-client using this command:

    sudo apt-get install mysql-server mysql-client
    

    and then some libraries you need to install to make MySQL available to ruby:

    sudo apt-get install libmysql-ruby
    

    This all solved my problem. Try it !!! :)

    0 讨论(0)
  • 2020-12-10 18:54

    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

    I've just followed the mysql installation steps and it worked great here :]

    0 讨论(0)
  • 2020-12-10 18:54

    I just encountered this as well on a fresh Snow Leopard install.

    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:

    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.

    0 讨论(0)
  • 2020-12-10 18:58

    Does the database already exist? Is MySQL setup and running? What changed? (OS Upgrade maybe)? Does a fresh rails app work? What about your other environments (test, production)?

    Is there a back trace? you could post (use rake --trace db:create). Usually MySQL is returns a very explicit error message, rake is just eating it.

    0 讨论(0)
  • 2020-12-10 19:04

    Using RVM? Do this for 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
    
    0 讨论(0)
提交回复
热议问题