WebFaction
Community site: login faq

Hi there,

in my account i have created a mysql database, and a rails 3 application.

I edited the database.yml as specified in this article, and i got the following error:

Access denied for user 'root'@'localhost' (using password: YES)

I then replaced the localhost in my database.yml to web164 (because i saw in my webfaction dashboard that that was the name of the db-machine). But then i get the following error:

Mysql::Error: Access denied for user 'root'@'web164.webfaction.com' (using password: YES)

I am able to get into my database using phpmysql, so my password should be correct. Anybody has a clue as to what could be wrong?

For completeness, here is my database.yml:

production: &db
  adapter: mysql
  database: nathanvda_voc
  user: nathanvda_voc
  password: *******
  host: web164

development:
  <<: *db

(i have obscured my password of course)

asked 16 Jan '11, 11:28

nathanvda
7510
accept rate: 0%

Where are you seeing the error? In your site, or when running migrate or some other command in SSH?

(16 Jan '11, 11:46) seanf

Hi Sean, when trying to either do rake db:setup or starting the Rails console (rails console) and then trying to get something from db (e.g. Post.all).

If i try mysql -u nathanvda_voc -h web164 -p i do get connected succesfully. I am a bit confused :)

(16 Jan '11, 13:08) nathanvda

Ha! I found it! I was able to connect to the database from the rails console using ActiveRecord::Base.establish_connection using an example from the documentation.

Sooooo, what was the difference? Apparently inside the database.yml you have to specify :username and not :user.

So i had to write it as follows to make it work:

production: &db
  adapter: mysql
  database: nathanvda_voc
  username: nathanvda_voc
  password: *******
  host: localhost

(and as you see: i could even use localhost then).

permanent link

answered 16 Jan '11, 13:21

nathanvda
7510
accept rate: 0%

That explains it :)

Since you did not provide 'username' as a parameter, the DB server assumed you were connecting as root, hence the error message.

For what it's worth, our documentation does specify 'username'. :)

(16 Jan '11, 13:38) seanf

I noticed that too :) The error was completely on my part ;)

(16 Jan '11, 14:10) nathanvda
Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×84
×28

question asked: 16 Jan '11, 11:28

question was seen: 3,130 times

last updated: 16 Jan '11, 14:10

WEBFACTION
REACH US
SUPPORT
AFFILIATE PROGRAM
LEGAL
© COPYRIGHT 2003-2019 SWARMA LIMITED - WEBFACTION IS A SERVICE OF SWARMA LIMITED
REGISTERED IN ENGLAND AND WALES 5729350 - VAT REGISTRATION NUMBER 877397162
5TH FLOOR, THE OLD VINYL FACTORY, HAYES, UB3 1HA, UNITED KINGDOM