# Mysql error

**URL:** <https://www.ruby-forum.com/t/mysql-error/94407>\
**Category:** Rails\
**Created:** [May 3, 2006, 6:58pm UTC](https://www.ruby-forum.com/t/mysql-error/94407 "2006-05-03T18:58:50Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![rohandey](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/ea5d25/32.png) [@rohandey](https://www.ruby-forum.com/u/rohandey)\
**Post date:** [May 3, 2006, 6:58pm UTC](https://www.ruby-forum.com/t/mysql-error/94407/1 "2006-05-03T18:58:50Z")

</div>

Hi,

```
I am starting new on rails.

```

Tried my first example got this error

#28000Access denied for user ‘root’@‘localhost’ (using password: NO)

Please do suggest as I am having this problem on one of my system but it  
works fine on the other.Really confused.

Thanks  
Rohan

---

<div class="post-metadata">

**Author:** ![rohandey](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/ea5d25/32.png) [@rohandey](https://www.ruby-forum.com/u/rohandey)\
**Post date:** [May 3, 2006, 7:14pm UTC](https://www.ruby-forum.com/t/mysql-error/94407/2 "2006-05-03T19:14:21Z")

</div>

rohan dey wrote:

> works fine on the other.Really confused.  
> What does your database.yml look like? At a guess, I’d say that you  
> haven’t got a password defined in it, and the database on one system  
> doesn’t need one, but the other does.

---

<div class="post-metadata">

**Author:** ![rohandey](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/ea5d25/32.png) [@rohandey](https://www.ruby-forum.com/u/rohandey)\
**Post date:** [May 3, 2006, 7:17pm UTC](https://www.ruby-forum.com/t/mysql-error/94407/3 "2006-05-03T19:17:16Z")

</div>

Alex Y. wrote:

> rohan dey wrote:
> 
> > works fine on the other.Really confused.  
> > What does your database.yml look like? At a guess, I’d say that you  
> > haven’t got a password defined in it, and the database on one system  
> > doesn’t need one, but the other does.

Thanks for the reply, please do look at this file

# MySQL (default setup). Versions 4.1 and 5.0 are recommended.

# 

# Install the MySQL driver:

# gem install mysql

# On MacOS X:

# gem install mysql – --include=/usr/local/lib

# On Windows:

# There is no gem for Windows. Install mysql.so from RubyForApache.

# [http://rubyforge.org/projects/rubyforapache](http://rubyforge.org/projects/rubyforapache)

# 

# And be sure to use new-style password hashing:

# [http://dev.mysql.com/doc/refman/5.0/en/old-client.html](http://dev.mysql.com/doc/refman/5.0/en/old-client.html)

development:  
adapter: mysql  
database: todo  
username: root  
password:root  
host: localhost

# 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: Todo\_test  
username: root  
password:  
host: localhost

production:  
adapter: mysql  
database: Todo\_production  
username: root  
password:  
host: localhost

---

<div class="post-metadata">

**Author:** ![rohandey](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/ea5d25/32.png) [@rohandey](https://www.ruby-forum.com/u/rohandey)\
**Post date:** [May 3, 2006, 7:32pm UTC](https://www.ruby-forum.com/t/mysql-error/94407/4 "2006-05-03T19:32:51Z")

</div>

rohan dey wrote:

> development:  
> adapter: mysql  
> database: todo  
> username: root  
> password:root  
> host: localhost  
> You need a space between the colon and the password. The password line  
> should literally be " password: root".
