n88
n88

Reputation: 25

Rails App [3.2.14] seems to be connecting to wrong database? [mysql]

I've created a simple app that pulls some info from a remote database... everything is working fine on my development station with both ENV=production & ENV=development (the database server is in my LAN, as well as the production web server).

When I go to put my app into production on the production server ( apache + phusion passenger) I get the "We're sorry but something went wrong" notice. Looking into my production.log shows the error responsible for ruining my day:

Started GET "/" for 76.. at 2013-09-30 14:38:08 -0700

Mysql2::Error (Access denied for user 'root'@'176.16.2.100' (using password: YES)):

My database.yml file:

development:
  adapter: mysql2
  encoding: utf8
  database: parts
  pool: 5
  host: 192.168.1.200
  port: 3306
  username: xxx
  password: xxxx

test:
  adapter: sqlite3
  database: db/test.sqlite3
  pool: 5
  timeout: 5000

production:
  adapter: mysql2
  database: parts
  encoding: utf8
  pool: 5
  timeout: 5000
  port: 3306
  host: 192.168.1.200
  user: xxx
  password: xxxx

Dropping into rails console yields the correct functionality (querying the 'parts' database works just fine) but as soon as I try to access the app from the web it tries to connect() to the wrong database? Any help/suggestions/solutions would be greatly appreciated!

Upvotes: 2

Views: 982

Answers (1)

Lajos Arpad
Lajos Arpad

Reputation: 76464

You use the keyword user for production. Also, I am not happy to see the real IP address and username in your post. You should be more secretive when you ask a question for your client's sake.

Upvotes: 3

Related Questions