Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7821375
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T07:37:48+00:00 2026-06-02T07:37:48+00:00

I am trying to create a Rails app that uses PostgreSQL. Here is a

  • 0

I am trying to create a Rails app that uses PostgreSQL. Here is a description of what I did.


PostgreSQL setup:
I installed PostgreSQL 9.1.3 via the ppa:pitti/postgresql maintained by Martin Pitt. There was PostgreSQL 8.4 installed before; I am not sure if it is still installed or gone.

  • I added a database user with superuser rights to the database that has the same name as my Ubuntu account.
  • I start the database daemon with sudo service postgresql start.
  • I installed pgadmin3, Version 1.14.0 Beta 1 via ppa:rhonda/pgadmin3 maintained by Gerfried Fuchs.
  • I can connect via pgadmin3 using my user account and password and port 5433.

My postgres configuration in pg_hba.conf is as follows (removed comments for readability).

[...]
local   all             postgres                                peer
local   all             all                                     peer
host    all             all             127.0.0.1/32            md5
host    all             all             ::1/128                 md5

Rails setup:
Now I want to create a Rails application that uses PostgreSQL.

  • I installed Ruby 1.9.3-p125 via RVM.
  • I installed Rails 3.2.3 into the Gemset ruby-1.9.3-p125@global.
  • I created a .rvmrc and Gemset for the application.
  • I created a Rails application via rails new my_test_app -d postgresql.
  • I configured the user name and password in config/database.yml for development and test and removed production.
  • I configured host: localhost and port: 5433 in config/database.yml.

Here is the content of my config/database.yml (removed comments for readability).

development:
  adapter: postgresql
  encoding: unicode
  database: my_test_app_development
  pool: 5
  username: johndoe
  password: password    
  host: localhost
  port: 5433

test:
  adapter: postgresql
  encoding: unicode
  database: my_test_app_test
  pool: 5
  username: johndoe
  password: password

Problem:
However, when I run bundle exec rake db:create:all I receive the following error message.

could not connect to server: No such file or directory
Is the server running locally and accepting connections on Unix domain socket
"/var/run/postgresql/.s.PGSQL.5432"?
[...]
Couldn't create database for {"adapter"=>"postgresql", "encoding"=>"unicode",
"database"=>"my_test_app_test", "pool"=>5, "username"=>"johndoe",
"password"=>"password"}

Question:
Why is the port different to the one I use when I successfully connect via pgadmin3?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-02T07:37:50+00:00Added an answer on June 2, 2026 at 7:37 am

    @Riateche: Finally, I saw that the database configuration for test environment misses the explicit settings for host and port. After I added the settings to the test environment, I was able to run the command bundle exec rake db:create:all successfully.
    I must say, I do not like that they suggest those settings for the development enviroment, but did not add them for the other environments. That makes it very likely to miss them, as I proofed.

    test:
      adapter: postgresql
      encoding: unicode
      database: my_test_app_test
      pool: 5
      username: johndoe
      password: password
      host: localhost
      port: 5433
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to deploy a Rails app that uses Bundler via Capistrano. Running cap
I'm trying to create a rails web app that does not use ActiveRecord framework
I'm trying to create a rails app that fetches album scores from PitchforkMedia.com For
I'm trying to create a User model for my Ruby on Rails app that
I'm trying to create a multi-level ajax form on my rails app that can
I'm trying to create a stream of actions in my rails App. Here are
I'm trying to create a rails app, but somethings going wrong, I'm getting a
I've been trying to create an order confirmation page for my rails app, and
I've got a Backbone.js/Rails app and I'm trying to create a new object through
I am trying to dynamically create divs in my Rails app through javascript. However,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.