简体   繁体   English

使用ROR应用程序设置mysql数据库时出现ArgumentError

[英]ArgumentError while setting up mysql database with ROR application

I have looked up for several issues on Stack overflow before, couldn't identify any of those much, with my query . 之前,我已经在Stack Overflow上查找了几个问题,无法通过我的查询找出其中的很多问题。 I want to set up a mysql database with my RoR App , but the following errors occur :- 我想用RoR App设置mysql数据库,但是会发生以下错误:

=> Booting WEBrick
=> Rails 2.3.14 application starting on h t t p: / / localhost:3000
/usr/lib/ruby/1.8/yaml.rb:133:in `load': syntax error on line 6, col 2: `  host: localhost' (ArgumentError)
    from /usr/lib/ruby/1.8/yaml.rb:133:in `load'
    from /home/sumit/Sites/world_geography/config/../vendor/rails/railties/lib/initializer.rb:926:in `database_configuration'
    from /home/sumit/Sites/world_geography/config/../vendor/rails/railties/lib/initializer.rb:437:in `initialize_database'
    from /home/sumit/Sites/world_geography/config/../vendor/rails/railties/lib/initializer.rb:141:in `process'
    from /home/sumit/Sites/world_geography/config/../vendor/rails/railties/lib/initializer.rb:113:in `send'
    from /home/sumit/Sites/world_geography/config/../vendor/rails/railties/lib/initializer.rb:113:in `run'
    from /home/sumit/Sites/world_geography/config/environment.rb:9
    from /usr/lib/ruby/vendor_ruby/1.8/rubygems/custom_require.rb:36:in `gem_original_require'
    from /usr/lib/ruby/vendor_ruby/1.8/rubygems/custom_require.rb:36:in `require'
    from /usr/lib/ruby/vendor_ruby/active_support/dependencies.rb:182:in `require'
    from /usr/lib/ruby/vendor_ruby/active_support/dependencies.rb:547:in `new_constants_in'
    from /usr/lib/ruby/vendor_ruby/active_support/dependencies.rb:182:in `require'
    from /home/sumit/Sites/world_geography/vendor/rails/railties/lib/commands/server.rb:84
    from /usr/lib/ruby/vendor_ruby/1.8/rubygems/custom_require.rb:36:in `gem_original_require'
    from /usr/lib/ruby/vendor_ruby/1.8/rubygems/custom_require.rb:36:in `require'
    from script/server:3
//////////////////////////////////////////////////////////////////////////////////////
ruby -v :-> ruby 1.8.7
rails -v :-> 2.3.14

Also my database.yml file :->

development:
  adapter: mysql
  database: world_data_dev
  username:root
  host: local_host
  port: 3000
  pool: 5
  timeout: 5000


# 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: mysql
  database: world_data_test
  username:root
  host: localhost
  port: 3000
  pool: 5
  timeout: 5000

production:
  adapter: mysql
  database: world_data_prod
  username:root
  host: localhost
  port: 3000
  pool: 5
  timeout: 5000

Thanks!

In your database.yml file give the space after username: 在您的database.yml文件中,在用户名后提供空格:

development:
  adapter: mysql
  database: world_data_dev
  username: root
  host: local_host
  port: 3000
  pool: 5
  timeout: 5000

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

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