ROR连接Mysql的数据库连接错误解决方案

好几天了,ROR连接mysql数据库总是出现各种莫明其妙的问题
引用

=> Booting WEBrick...

D:/ruby/lib/ruby/1.8/yaml.rb:133:in `load': syntax error on line 6, col 15: `' (ArgumentError)

        from D:/ruby/lib/ruby/1.8/yaml.rb:133:in `load'

        from D:/ruby/lib/ruby/gems/1.8/gems/rails-2.0.2/lib/initializer.rb:506:in `database_configuration'

        from D:/ruby/lib/ruby/gems/1.8/gems/rails-2.0.2/lib/initializer.rb:233:in `initialize_database'

        from D:/ruby/lib/ruby/gems/1.8/gems/rails-2.0.2/lib/initializer.rb:94:in `process'

        from D:/ruby/lib/ruby/gems/1.8/gems/rails-2.0.2/lib/initializer.rb:49:in `send'

        from D:/ruby/lib/ruby/gems/1.8/gems/rails-2.0.2/lib/initializer.rb:49:in `run'

        from C:/Documents and Settings/liangliang/My Documents/NetBeansProjects/hello/config/environment.rb:13

        from D:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in `gem_original_require'

         ... 10 levels...

        from D:/ruby/lib/ruby/gems/1.8/gems/rails-2.0.2/lib/commands/server.rb:39

        from D:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in `gem_original_require'

        from D:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in `require'

        from script/server:3



今天发现如下规律
database.yaml的配置文件一定要按照它的格式写,包括空格,如下:
引用

development:
adapter: mysql
encoding: utf8
database: shendan
username: root
password: 3594746
host: localhost

这里最容易犯错的地方就是在参数值前面没有加上空格,记住一定要加上空格,一切就OK了。

你可能感兴趣的:(c,mysql,Ruby,rubygems,Rails)