# Why would ActiveRecord connect to Postgres as root?

**URL:** <https://www.ruby-forum.com/t/why-would-activerecord-connect-to-postgres-as-root/130869>\
**Category:** Rails\
**Created:** [March 4, 2008, 2:16am UTC](https://www.ruby-forum.com/t/why-would-activerecord-connect-to-postgres-as-root/130869 "2008-03-04T02:16:07Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![stubbsuk](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/e56c9b/32.png) [@stubbsuk](https://www.ruby-forum.com/u/stubbsuk)\
**Post date:** [March 4, 2008, 2:16am UTC](https://www.ruby-forum.com/t/why-would-activerecord-connect-to-postgres-as-root/130869/1 "2008-03-04T02:16:07Z")

</div>

My databases.yml makes no mention of root and in my dev environment  
everything works fine, however following a deployment with Capistrano  
about an hour ago, I get the following error:

PGError in HomeController#index

FATAL: role “root” does not exist

/usr/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active\_record/  
connection\_adapters/postgresql\_adapter.rb:713:in `connect' /usr/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/ connection_adapters/postgresql_adapter.rb:713:in`connect’  
/usr/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active\_record/  
connection\_adapters/postgresql\_adapter.rb:237:in `initialize' /usr/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/ connection_adapters/postgresql_adapter.rb:23:in`new’  
/usr/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active\_record/  
connection\_adapters/postgresql\_adapter.rb:23:in  
`postgresql_connection' /usr/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/ connection_adapters/abstract/connection_specification.rb:291:in`send’  
/usr/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active\_record/  
connection\_adapters/abstract/connection\_specification.rb:291:in  
`connection=' /usr/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/ connection_adapters/abstract/connection_specification.rb:259:in`retrieve\_connection’  
/usr/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active\_record/  
connection\_adapters/abstract/connection\_specification.rb:78:in  
`connection' /usr/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/ query_cache.rb:8:in`cache’  
/usr/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action\_controller/  
caching.rb:677:in `perform_action' /usr/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/ base.rb:524:in`send’  
/usr/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action\_controller/  
base.rb:524:in `process_without_filters' /usr/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/ filters.rb:685:in`process\_without\_session\_management\_support’  
/usr/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action\_controller/  
session\_management.rb:123:in `process' /usr/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/ base.rb:388:in`process’  
/usr/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action\_controller/  
dispatcher.rb:171:in `handle_request' /usr/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/ dispatcher.rb:115:in`dispatch’  
/usr/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action\_controller/  
dispatcher.rb:126:in `dispatch_cgi' /usr/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/ dispatcher.rb:9:in`dispatch’  
/usr/lib/ruby/gems/1.8/gems/mongrel-1.1.3/lib/mongrel/rails.rb:76:in  
`process' /usr/lib/ruby/gems/1.8/gems/mongrel-1.1.3/lib/mongrel/rails.rb:74:in`synchronize’  
/usr/lib/ruby/gems/1.8/gems/mongrel-1.1.3/lib/mongrel/rails.rb:74:in  
`process' /usr/lib/ruby/gems/1.8/gems/mongrel-1.1.3/lib/mongrel.rb:159:in`process\_client’  
/usr/lib/ruby/gems/1.8/gems/mongrel-1.1.3/lib/mongrel.rb:158:in `each' /usr/lib/ruby/gems/1.8/gems/mongrel-1.1.3/lib/mongrel.rb:158:in`process\_client’  
/usr/lib/ruby/gems/1.8/gems/mongrel-1.1.3/lib/mongrel.rb:285:in `run' /usr/lib/ruby/gems/1.8/gems/mongrel-1.1.3/lib/mongrel.rb:285:in`initialize’  
/usr/lib/ruby/gems/1.8/gems/mongrel-1.1.3/lib/mongrel.rb:285:in `new' /usr/lib/ruby/gems/1.8/gems/mongrel-1.1.3/lib/mongrel.rb:285:in`run’  
/usr/lib/ruby/gems/1.8/gems/mongrel-1.1.3/lib/mongrel.rb:268:in  
`initialize' /usr/lib/ruby/gems/1.8/gems/mongrel-1.1.3/lib/mongrel.rb:268:in`new’  
/usr/lib/ruby/gems/1.8/gems/mongrel-1.1.3/lib/mongrel.rb:268:in `run' /usr/lib/ruby/gems/1.8/gems/mongrel-1.1.3/lib/mongrel/configurator.rb: 282:in`run’  
/usr/lib/ruby/gems/1.8/gems/mongrel-1.1.3/lib/mongrel/configurator.rb:  
281:in `each' /usr/lib/ruby/gems/1.8/gems/mongrel-1.1.3/lib/mongrel/configurator.rb: 281:in`run’  
/usr/lib/ruby/gems/1.8/gems/mongrel-1.1.3/bin/mongrel\_rails:128:in  
`run' /usr/lib/ruby/gems/1.8/gems/mongrel-1.1.3/lib/mongrel/command.rb: 212:in`run’  
/usr/lib/ruby/gems/1.8/gems/mongrel-1.1.3/bin/mongrel\_rails:281  
/usr/bin/mongrel\_rails:19:in `load’  
/usr/bin/mongrel\_rails:19

The site’s been working fine for weeks, but now it’s down, just as I  
was starting to build up users … typical 🙂

-S

---

<div class="post-metadata">

**Author:** ![stubbsuk](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/e56c9b/32.png) [@stubbsuk](https://www.ruby-forum.com/u/stubbsuk)\
**Post date:** [March 4, 2008, 2:51am UTC](https://www.ruby-forum.com/t/why-would-activerecord-connect-to-postgres-as-root/130869/2 "2008-03-04T02:51:52Z")

</div>

Check your database.yml file again, and again.

It does not spontaneously choose one day to go root.

On Tue, Mar 4, 2008 at 11:45 AM, Stuart G.  
[removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
wrote:

> connection\_adapters/postgresql\_adapter.rb:713:in `connect' connection_adapters/abstract/connection_specification.rb:291:in `send’  
> query\_cache.rb:8:in `cache' /usr/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/ `process’  
> /usr/lib/ruby/gems/1.8/gems/mongrel-1.1.3/lib/mongrel.rb:285:in  
> 281:in `each’  
> The site’s been working fine for weeks, but now it’s down, just as I  
> was starting to build up users … typical 🙂
> 
> -S
> 
> >

–  
Ryan B.

> **[frozenplague.net](http://www.frozenplague.net)**
>
> This domain may be for sale!

Feel free to add me to MSN and/or GTalk as this email.

---

<div class="post-metadata">

**Author:** ![stubbsuk](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/e56c9b/32.png) [@stubbsuk](https://www.ruby-forum.com/u/stubbsuk)\
**Post date:** [March 4, 2008, 8:12am UTC](https://www.ruby-forum.com/t/why-would-activerecord-connect-to-postgres-as-root/130869/3 "2008-03-04T08:12:02Z")

</div>

On Mar 4, 1:50 am, “Ryan B. (Radar)” [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
wrote:

> Check your database.yml file again, and again.
> 
> It does not spontaneously choose one day to go root.

You would think that wouldn’t you Ryan … with the passwords removed,  
database.yml is reproduced below, in full …

# SQLite version 3.x

# gem install sqlite3-ruby (not necessary on OS X Leopard)

development:  
adapter: postgresql  
database: footytechs-dev  
user: footytechs  
password: password  
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: postgresql  
database: footytechs-test  
user: footytechs  
password: password  
host: localhost

production:  
adapter: postgresql  
database: footytechs-prod  
user: footytechs  
password: password  
host: localhost
