A few day ago I was struggling with some strange (for me as a beginner) problem with PostgreSQL database during generate some application skeleton. Running some: rails new app —database=postgresql and after that: rake db:migrate or rake db:create cause the fallowing problem:

I restart also database but the problem still appears. So I start to looking for some answer. First I check if my database it’s running, to perform some simple check:

This simple command should display all processes that are running and also connected with PostgreSQL, but of corse, in my case, output was totally different. PostgreSQL was not running at all:

I have PostgreSQL data files from a previous version of PostgreSQL and they are not compatible with current one. One solution was to delete all data and get a fresh database, basically to wipe data from PostrgreSQL completely including the user and data files.

After that:

and

from my rails application to get setup again. Next step was to check if my changes work as intended:

First process that is displayed gere is a masterserver process. The command shown for it are the same ones given when it was launched. Next two ones are the bacground workers processes launched automatically by the master process. Each of the remaining processes is a server process handling one client connection.

So I we can see this simple solution resolve problem with database on version 9.5.