PostgreSQL error fix :couldn't connect to server and installation
According to this PostgreSQL is a powerful, open source object-relational database system with over 30 years of active development that has earned it a strong reputation for reliability, feature robustness, and performance.
So first we look forward to installation procedure and then we will try to fix the error :couldn't connect to server later ..
1. Windows installation of PostgreSQL Click to Download install the Postgres with the package
once you download we will move to install the package see the following steps to install it.
2.
3. So once you install this you have pgAdmin in your package open it and then move forward in creating the database in the pgAdmin you can do this in two ways either in pgAdmin or the shell of postgreSQL, so we will move to create server now.
4. For this Server > Create > Server
5. You can also do by this method to create server in shell
6. Coming towards DB creating database again can be done in the cmd prompt or using the pgAdmin
so here you need to give cmd
createdb -h localhost -p 5432 -U postgres projectname
createdb -h localhost -p 5432 -U postgres projectname password
So, here we are done with creating Server and DB so now lets move on to fixing our error.
Error fix :couldn't connect to server
When connecting to a PostgreSQL server, you may get an error message this is most common error look forward to fix this issues these might be any possible solution for the errorFirst solution:
1. First check the status of the postgres if it shows online then you can stop and restart it.
sudo service postgresql status
2. sudo service postgresql stop
3. sudo service postgresql start
4. sudo service postgresql restart
Second solution :
1.open PostgreSQL.conf
cd /etc/postgresql/9.x/main/
sudo vi postgresql.conf
listen_addresses = '*'
sudo vi pg_hba.conf
host all all 0.0.0.0/0 md5
sudo /etc/init.d/postgresql restart