好的,我有这个工作,我不确定我可以改变什么以使rake db:create
现在不工作。我跑去rake db:drop
删除我的数据库,这样我就可以从头开始,现在rake db:create
遇到了问题。
下面是我的堆栈跟踪。我不确定如何解决此问题。
$ rake db:create --trace
** 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
rake aborted!
can't convert Hash into String
/Users/TomCaflisch/.rvm/gems/ruby-1.9.3-p327@famnfo/gems/mysql2-0.3.11/lib/mysql2/client.rb:44:in `connect'
/Users/TomCaflisch/.rvm/gems/ruby-1.9.3-p327@famnfo/gems/mysql2-0.3.11/lib/mysql2/client.rb:44:in `initialize'
/Users/TomCaflisch/.rvm/gems/ruby-1.9.3-p327@famnfo/gems/activerecord-3.1.8/lib/active_record/connection_adapters/mysql2_adapter.rb:17:in `new'
/Users/TomCaflisch/.rvm/gems/ruby-1.9.3-p327@famnfo/gems/activerecord-3.1.8/lib/active_record/connection_adapters/mysql2_adapter.rb:17:in `mysql2_connection'
/Users/TomCaflisch/.rvm/gems/ruby-1.9.3-p327@famnfo/gems/activerecord-3.1.8/lib/active_record/connection_adapters/abstract/connection_pool.rb:304:in `new_connection'
/Users/TomCaflisch/.rvm/gems/ruby-1.9.3-p327@famnfo/gems/activerecord-3.1.8/lib/active_record/connection_adapters/abstract/connection_pool.rb:323:in `checkout_new_connection'
/Users/TomCaflisch/.rvm/gems/ruby-1.9.3-p327@famnfo/gems/activerecord-3.1.8/lib/active_record/connection_adapters/abstract/connection_pool.rb:265:in `block (2 levels) in checkout'
/Users/TomCaflisch/.rvm/gems/ruby-1.9.3-p327@famnfo/gems/activerecord-3.1.8/lib/active_record/connection_adapters/abstract/connection_pool.rb:261:in `loop'
/Users/TomCaflisch/.rvm/gems/ruby-1.9.3-p327@famnfo/gems/activerecord-3.1.8/lib/active_record/connection_adapters/abstract/connection_pool.rb:261:in `block in checkout'
/Users/TomCaflisch/.rvm/rubies/ruby-1.9.3-p327/lib/ruby/1.9.1/monitor.rb:211:in `mon_synchronize'
/Users/TomCaflisch/.rvm/gems/ruby-1.9.3-p327@famnfo/gems/activerecord-3.1.8/lib/active_record/connection_adapters/abstract/connection_pool.rb:260:in `checkout'
/Users/TomCaflisch/.rvm/gems/ruby-1.9.3-p327@famnfo/gems/activerecord-3.1.8/lib/active_record/connection_adapters/abstract/connection_pool.rb:162:in `connection'
/Users/TomCaflisch/.rvm/gems/ruby-1.9.3-p327@famnfo/gems/activerecord-3.1.8/lib/active_record/connection_adapters/abstract/connection_pool.rb:409:in `retrieve_connection'
/Users/TomCaflisch/.rvm/gems/ruby-1.9.3-p327@famnfo/gems/activerecord-3.1.8/lib/active_record/connection_adapters/abstract/connection_specification.rb:115:in `retrieve_connection'
/Users/TomCaflisch/.rvm/gems/ruby-1.9.3-p327@famnfo/gems/activerecord-3.1.8/lib/active_record/connection_adapters/abstract/connection_specification.rb:89:in `connection'
/Users/TomCaflisch/.rvm/gems/ruby-1.9.3-p327@famnfo/gems/activerecord-3.1.8/lib/active_record/railties/databases.rake:86:in `rescue in create_database'
/Users/TomCaflisch/.rvm/gems/ruby-1.9.3-p327@famnfo/gems/activerecord-3.1.8/lib/active_record/railties/databases.rake:54:in `create_database'
/Users/TomCaflisch/.rvm/gems/ruby-1.9.3-p327@famnfo/gems/activerecord-3.1.8/lib/active_record/railties/databases.rake:42:in `block (2 levels) in <top (required)>'
/Users/TomCaflisch/.rvm/gems/ruby-1.9.3-p327@famnfo/gems/rake-10.0.2/lib/rake/task.rb:227:in `call'
/Users/TomCaflisch/.rvm/gems/ruby-1.9.3-p327@famnfo/gems/rake-10.0.2/lib/rake/task.rb:227:in `block in execute'
/Users/TomCaflisch/.rvm/gems/ruby-1.9.3-p327@famnfo/gems/rake-10.0.2/lib/rake/task.rb:222:in `each'
/Users/TomCaflisch/.rvm/gems/ruby-1.9.3-p327@famnfo/gems/rake-10.0.2/lib/rake/task.rb:222:in `execute'
/Users/TomCaflisch/.rvm/gems/ruby-1.9.3-p327@famnfo/gems/rake-10.0.2/lib/rake/task.rb:166:in `block in invoke_with_call_chain'
/Users/TomCaflisch/.rvm/rubies/ruby-1.9.3-p327/lib/ruby/1.9.1/monitor.rb:211:in `mon_synchronize'
/Users/TomCaflisch/.rvm/gems/ruby-1.9.3-p327@famnfo/gems/rake-10.0.2/lib/rake/task.rb:159:in `invoke_with_call_chain'
/Users/TomCaflisch/.rvm/gems/ruby-1.9.3-p327@famnfo/gems/rake-10.0.2/lib/rake/task.rb:152:in `invoke'
/Users/TomCaflisch/.rvm/gems/ruby-1.9.3-p327@famnfo/gems/rake-10.0.2/lib/rake/application.rb:141:in `invoke_task'
/Users/TomCaflisch/.rvm/gems/ruby-1.9.3-p327@famnfo/gems/rake-10.0.2/lib/rake/application.rb:99:in `block (2 levels) in top_level'
/Users/TomCaflisch/.rvm/gems/ruby-1.9.3-p327@famnfo/gems/rake-10.0.2/lib/rake/application.rb:99:in `each'
/Users/TomCaflisch/.rvm/gems/ruby-1.9.3-p327@famnfo/gems/rake-10.0.2/lib/rake/application.rb:99:in `block in top_level'
/Users/TomCaflisch/.rvm/gems/ruby-1.9.3-p327@famnfo/gems/rake-10.0.2/lib/rake/application.rb:108:in `run_with_threads'
/Users/TomCaflisch/.rvm/gems/ruby-1.9.3-p327@famnfo/gems/rake-10.0.2/lib/rake/application.rb:93:in `top_level'
/Users/TomCaflisch/.rvm/gems/ruby-1.9.3-p327@famnfo/gems/rake-10.0.2/lib/rake/application.rb:71:in `block in run'
/Users/TomCaflisch/.rvm/gems/ruby-1.9.3-p327@famnfo/gems/rake-10.0.2/lib/rake/application.rb:158:in `standard_exception_handling'
/Users/TomCaflisch/.rvm/gems/ruby-1.9.3-p327@famnfo/gems/rake-10.0.2/lib/rake/application.rb:68:in `run'
/Users/TomCaflisch/.rvm/gems/ruby-1.9.3-p327@famnfo/gems/rake-10.0.2/bin/rake:37:in `<top (required)>'
/Users/TomCaflisch/.rvm/gems/ruby-1.9.3-p327@famnfo/bin/rake:19:in `load'
/Users/TomCaflisch/.rvm/gems/ruby-1.9.3-p327@famnfo/bin/rake:19:in `<main>'
/Users/TomCaflisch/.rvm/gems/ruby-1.9.3-p327@famnfo/bin/ruby_noexec_wrapper:14:in `eval'
/Users/TomCaflisch/.rvm/gems/ruby-1.9.3-p327@famnfo/bin/ruby_noexec_wrapper:14:in `<main>'
Tasks: TOP => db:create
数据库.yml
# SQLite version 3.x
# gem install sqlite3
#
# Ensure the SQLite 3 gem is defined in your Gemfile
# gem 'sqlite3'
development:
adapter: mysql2
encoding: utf8
database: FamNFo_development
# local
username: root
password:
# server
# username: famnfo_dev
# password: Panther89!1
# local
socket: /tmp/mysql.sock
# server
# socket: /var/lib/mysql/mysql.sock
# Warning: The database defined as "test" will be erased and
# re-generated from your development database when you run "rake".
# Do not set this db to the same as development or production.
test:
adapter: mysql2
encoding: utf8
database: FamNFo_test
# local
# username: root
# password:
# server
username: root
password:
# local
socket: /tmp/mysql.sock
# server
#socket: /var/lib/mysql/mysql.sock
production:
adapter: mysql2
encoding: utf8
database: FamNFo_production
# local
# username: root
# password:
# server
username: myusername
password: mypassword
# local
# socket: /tmp/mysql.sock
# server
socket: /var/lib/mysql/mysql.sock