开发者

ruby on rails $ mysql

I am configure the mysql instead of sqlite3 and the output is :

=> Booting WEBrick    
=> Rails 2.3.11 application starting on http://0.0.0.0:3000   
C:/Ruby192/lib/ruby/1.9.1/syck.rb:135:in `load': syntax error on line 24, col 18: `' (ArgumentError)   
        from C:/Ruby192/lib/ruby/1.9.1/syck.rb:135:in `load'  
        from C:/Ruby192/lib/ruby/gems/1.9.1/gems/rails-2.3.11/lib/initializer.rb:927:in `database_configuration'  
        from C:/Ruby192/lib/ruby/gems/1.9.1/gems/rails-2.3.11/lib/initializer.rb:437:in `initialize_database'   
        from C:/Ruby192/lib/ruby/gems/1.9.1/gems/rails-2.3.11/lib/initializer.rb:141:in `process'   
        from C:/Ruby192/lib/ruby/gems/1.9.1/gems/rails-2.3.11/lib/initializer.rb:113:in `run'  
        from C:/rails/rail/config/environment.rb:9:in `<top (required)>'    
        from <internal:lib/rubygems/custom_require>:29:in `require'  
        from <internal:lib/rubygems/custom_require>:29:in `require'  
        from C:/Ruby192/lib/ruby/gems/1.9.1/gems/activesupport2.3.11/lib/active_support/dependencies.rb:182:in `blo开发者_Python百科ck in require'  
        from C:/Ruby192/lib/ruby/gems/1.9.1/gems/activesupport2.3.11/lib/active_support/dependencies.rb:547:in `new_constants_in'  
        from C:/Ruby192/lib/ruby/gems/1.9.1/gems/activesupport2.3.11/lib/active_support/dependencies.rb:182:in `require'  
        from C:/Ruby192/lib/ruby/gems/1.9.1/gems/rails-2.3.11/lib/commands/server.rb:84:in `<top (required)>'  
        from <internal:lib/rubygems/custom_require>:29:in `require'  
        from <internal:lib/rubygems/custom_require>:29:in `require'  
        from script/server:3:in `<main>'

Could someone tell me what is wrong here? It seems like there is something wrong with the code because it doesn't work. I will appreciate a lot the help from yours

here is my yml file for mysql

development:      
adapter: mysql   
database: test  
username:false  
password:neha  
host :localhost  
port:3306 


use above tab sequence in all of your environment

development:
 adapter: mysql
 database: test
 username:false
 password:neha
 host :localhost
 port:3306 


Couple of issues:

  1. host :localhost should be host: localhost. Note the position of the : character - having it after the space is what gives you that syntax error. I get exactly the same stacktrace if the YAML is set up as you have it.

  2. You need to indent the attributes of the development hash. This won't make the YAML invalid, but it will give you the wrong result. If you don't indent, you'll get a series of key => value hashes, instead of a hash containing a development key, which in turn has child attributes for the configuration params.


There's something wrong with your YAML configuration. Syck is YAML parser that fails to load YAML configuration files. Check the configuration for typos, especially config/database.yml.

Also, use username:"false" in your configuration. true of false without quotes will be interpreted as TrueClass, not String, and that might cause trouble.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜