---
title: "ROR: syntax error on line 18, col 2: `  host: localhost'"
author: "andyao"
date: "2007-09-16T00:16:45Z"
tags: ["C", "C#", "C++", "Netbeans", "Ruby"]
slug: "ror-syntax-error-on-line-18-col-2-host-localhost"
draft: false
lastmod: "2007-09-16T00:16:45Z"
id: 124467
url: "https://andyao.iteye.com/blog/124467"
---

用netbeans ruby ide第一个demo就出错：

ruby 代码

01. rake aborted!
02. syntax error on line 18, col 2: \`  host: localhost'
03. rake aborted!
04. Invalid escape character syntax: /E:\\My Documents\\NetBeansProjects\\depot\\Rakefile/
05. C:/ruby/lib/ruby/gems/1.8/gems/rake-0.7.3/lib/rake.rb:1772:in \`standard\_exception\_handling': Invalid escape character syntax: /E:\\My Documents\\NetBeansProjects\\depot\\Rakefile/ (RegexpError)
06. from C:/ruby/lib/ruby/gems/1.8/gems/rake-0.7.3/lib/rake.rb:1772:in \`find'
07. from C:/ruby/lib/ruby/gems/1.8/gems/rake-0.7.3/lib/rake.rb:1772:in \`each'
08. from C:/ruby/lib/ruby/gems/1.8/gems/rake-0.7.3/lib/rake.rb:1772:in \`find'
09. from C:/ruby/lib/ruby/gems/1.8/gems/rake-0.7.3/lib/rake.rb:1772:in \`standard\_exception\_handling'
10. from C:/ruby/lib/ruby/gems/1.8/gems/rake-0.7.3/lib/rake.rb:1708:in \`run'
11. from C:/ruby/lib/ruby/gems/1.8/gems/rake-0.7.3/bin/rake:7
12. from C:/ruby/bin/rake:16:in \`load'
13. from C:/ruby/bin/rake:16

google搜索才知道database.xml文件里面数据库Password后面少了一个空格

ruby 代码

1. #注意字段冒号和真实的值之间有空格
2. evelopment:
3. adapter: mysql
4. database: depot\_development
5. username: root
6. password: 1q2w
7. host: localhost