SSL on postgresql FATAL ERROR - postgresql

I'm currently working on ubuntu 16.04. When I make ssl configurations for postgresql and then restart the service with this command:
/etc/init.d/postgresql restart
My database starts refusing the connections
psql: 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"?
How can I fix this?

Related

connect pgadmin3 to postgres runnng on server

** new to pgadmin and postgress **
my organization uses PostgreSQL on its server with ubuntu os, I try to connect it using pgadmin 3,
these are the stapes I have taken
changed pg_hba.conf using 'sudo nano /etc/postgresql/9.3/main/pg_hba.conf'
changed listen_addresses='*' in postgresql.conf file
sudo ufw allow 5432/tcp
but still, I am unable to connect I get this error from pg admin:
Server doesn't listen
The server doesn't accept connections: the connection library reports could not connect to server: Connection timed out Is the server running on host "103.72.131.155" and accepting TCP/IP connections on port 5432?
how can I fix it,
is there any website which can guide me step by step to connect pgadmin to PostgreSQL.

psql : could not connect to server:

I recently installed ubuntu and downloaded postgres from brew, but when trying to get into psql I get this error:
psql: error: could not connect to server: could not connect to server: No such file or directory
Is the server running locally and accepting
connections on Unix domain socket "/tmp/.s.PGSQL.5432"?
I have tried alternative varias and without success, could anyone help

PostgreSQL server Connection error: could not connect to server

I am using pgAdmin4 and developing a node.js app.I had an abrupt shutdown of the computer and I can no longer connect to the postgresql server.
The error I get when trying to connect is :
psql: could not connect to server: Connection refused (0x0000274D/10061)
Is the server running on host "localhost" (::1) and
accepting TCP/IP connections on port 5432?
could not connect to server: Connection refused (0x0000274D/10061)
Is the server running on host "localhost" (127.0.0.1) and
accepting TCP/IP connections on port 5432?
I tried to run postgres -D /usr/local/var/postgres/ as suggested in this SO answer. However it gave me the following error :
postgres: could not access directory "usr/loval/var/postgres": No such file or directory
Run initdb or pg_basebackup to initialize a PostgreSQL data directory.
So I just manually deleted the postmaster.pid file inside the PostgreSQL/.../data folder. But I still cannot connect to the database server.
I have checked the postgresql.conf file, and
the listen addresses is already set as listen_addresses = '*', and the port is set to 5432.
I also tried deleting the pgAdmin file in the AppData/Roaming folder.But it gave me an error:
The application server could not be contacted
and then afterwards the same problem of not being able to connect to the server happens.
Funny enough, it was a matter of just deleting the pdAdmin file in AppData/Roaming folder, and then restarting the computer and restarting the pgAdmin4. That solved it for me.
Meet the same challenge while settings up PostgreSQL to work with a Python/Django project.And i resolved the issue here, after reading the official PostgreSQL-9.6.16 documentation.

Postgres connection error in ubuntu and centos

I am new to postgres. While connecting through ubuntu and centos I'm getting this error:
psql: 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"?
Give permission to all host by editing ipv4 entry in pg_hba.conf file.
After modification restart postgresql service.

Postgresql server is running on local machine but psql can not connect

After doing brew install postgres:
brew install postgres
brew link --overwrite postgresql
Postgres is already running:
/~ $brew services start postgresql
Service `postgresql` already started, use `brew services restart postgresql` to restart.
But then how do we connect using psql client?
13:47:28/~ $psql
psql: could not connect to server: No such file or directory
Is the server running locally and accepting
connections on Unix domain socket "/tmp/.s.PGSQL.5432"?
Updates Tried various suggestions.
Try restarting ..
$brew services start postgresql
Service `postgresql` already started, use `brew services restart postgresql` to restart.
14:37:19/fastparquet $brew services restart postgresql
Stopping `postgresql`... (might take a while)
==> Successfully stopped `postgresql` (label: homebrew.mxcl.postgresql)
==> Successfully started `postgresql` (label: homebrew.mxcl.postgresql)
14:37:39/fastparquet $psql
psql: could not connect to server: No such file or directory
Is the server running locally and accepting
connections on Unix domain socket "/tmp/.s.PGSQL.5432"?
14:37:55/fastparquet $
Connect to localhost?
14:37:34/fastparquet $psql -h localhost
psql: 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?
The link from a_horse_with_no_name did the trick. Specifically:
initdb -D /usr/local/var/postgres/
(from Homebrew postgres broken )
and then
createdb
(the latter from psql: FATAL: database "<user>" does not exist )