Upgrading from Sqlite to PostgreSQL on Rails for Heroku

heroku
ruby
postgresql
ubuntu

#1

I’ve followed all of the documentation (https://devcenter.heroku.com/articles/sqlite3.html) on how to upgrade my development server from Sqlite to PostgreSQL. Despite changing the database.yml file etc when I try to run the local server I get the error message:

PG::ConnectionBad (could not connect to server: Connection refused
Is the server running on host “localhost” (::1) and accepting
TCP/IP connections on port 5432?
could not connect to server: Connection refused
Is the server running on host “localhost” (127.0.0.1) and accepting
TCP/IP connections on port 5432?

It seems I need to change the user name in the pg_hba.conf from postgres to ubuntu but I can’t even get access to the file. I have found the path but all of my attempts to access it have failed including trying to chmod the main file where the pg_hba.conf file is. Can somebody help please give any pointers? hopefully there are others who have had this specific problem? Thanks


#2

When you get that error it means that the postgresql service is probably not running. Start/re-start it and try again:

sudo service postgresql start


#3

Thank you so much, I had to do a few other little things and that worked! Very much appreciated!