-2

I'm getting the mentioned error when deploying a Rails app locally using Phusion Passenger.

My config/database.yml file contains the following:

production:
  adapter: mysql2
  encoding: utf8
  reconnect: false
  database: <%= ENV["DB_NAME"] %>
  pool: 5
  username: <%= ENV["DB_USER"] %>
  password: <%= ENV["DB_PASS"] %>
  host: <%= ENV["DB_HOST"] %>

The ENV["KEY"] values are stored in secrets.yml, and they're correctly retrieved.

1 Answers1

2

you need to first go to the command line and make sure you can connect to the database to debug the issue.

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

this error above states you're not using a password

if you do or do not have the password, issue this in your mysql command line

> mysql -u root -p{password}

when you say the application isn't asking you for one but there is an entry for the password in your conig file

  password: <%= ENV["DB_PASS"] %>
unixmiah
  • 3,081
  • 1
  • 12
  • 26
  • Thank you very much for your answer. I could indeed access mysql with root user and password. The problem was with the credentials to access the db, my user didn't had privileges to access it. It is weird because I granted privileges yesterday but I had to do it again today. I hope it is now permanent. – Oscar Fabra Dec 08 '14 at 02:13
  • have you done flush privileges? after you granted privileges? – unixmiah Dec 08 '14 at 02:31