Problems trying to configure Ecrire with postgresql - postgresql

I've been trying to configure Ecrire with my postgresql database, but I keep running into this error whenever I input psql -d postgres.
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"?
I just don't know how to fix this. Please help!

Is the database running?
ps auxwf | grep postgres
It's also possible that the socket file is in another directory, or the database is listening on another port. Can you post the values "unix_socket_directories" and "port" from your postgresql.conf file?

Related

PostgreSQL: could not connect to server

I have an issue that I've been trying to fix but after reading articles, I couldn't do anything about it. The problem is as it follows:
I just installed Apache, php and MySQL on a VPS. Then I had to install PostgreSQL and set up a database and a new user. After running the psql command, I got the following output:
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"?
So, my question is how do I fix this. I'd be grateful if I receive some feedback.

Saving PostgreSQL database to an external HDD

I need to save a database to an external HDD. This question has been asked previously here. However, upon changing the data_directory variable in the postgresql.conf file that exists in /usr/local/var/postgres/ to
data_directory = /path/to/externalHDD/directory/
I then restart the PostgreSQL server with brew services restart postgresql, but when I try to reconnect to the database via
psql -U username -d postgres
I receive the following error:
psql: error: 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"?
How do I fix this?
If all you did was point data_directory somewhere else, that cannot work, because there is no data directory at the destination. You have to create the data directory using initdb.

pqxx: broken_connection on trying to connect to posgres db

I have this problem trying to connect to the local postrgres databases. Until now i succeeded to connect to the same databases using jdbc or working directly in PGAdmin, this error happens when i try to connect using pqxx library or from shell:
pqxx code:
#include <pqxx/connection.hxx>
int main(){
pqxx::connection conn("user=postgres port=5432 dbname=pqxx-test password=postgres");
return 0;
}
or from shell, as user postgres:
psql pqxx-test
both the cases raise this error:
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"
Searching for the solution i think i understood i have to edit pq_hba.conf and postgresql.conf files in order to connect in these ways, but in pg_hba.conf is already set:
local all all md5
and in postgresql.conf
listen_addresses='*'
And by the way, i'm not even able to edit these files because of a problem with the viminfo, but maybe this is another problem..
Can anyone help me?
edit:
using PostgreSQL 9.6.2
on Ubuntu 14.04
edit:
as postgres user, if i ask for the postgre version using:
psql -V
the result is 9.6.2
but looking at the file system hierarchy, all conf file are inside this folder
/opt/PostreSQL/9.4/data/
can that be the problem?
You seem to have a mix of client-side postgresql 9.6 configured for the ubuntu FS layout and a postgresql server 9.4 presumably downloaded from EntrepriseDB (and installed under /opt/PostgreSQL) using its own layout.
Assuming that the postgresql is running, the simplest solution is to add host=localhost to your connection string, so that it will use a TCP connection instead of the Unix domain socket /var/run/postgresql/.s.PGSQL.5432 that does not exist because of the mismatch.

GPDB-psql: could not connect to server: No such file or directory

We have the small array of Greenplum database.In that, We have a master node. when I am trying to use PSQL utility
Getting this error :
[gpadmin#master gpseg-1]$ 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"?
We tried
on searching for postmaster.pid files.We have removed it.But still, the error remains.
You need to export your PGPORT and source Postgres.sh_path(inside your GPDB).
After that you will be able to do psql and connect to the database.

postgres psql giving permission denied but I can use pgadmin ok

I get
psql: could not connect to server: Permission denied
Is the server running locally and accepting
connections on Unix domain socket "/var/pgsql_socket/.s.PGSQL.5432"?
but if I use pgadmin I can double click on a db and use it ok.
I think pg is running but permissions issue?
Looks like you have set different permissions for connections from Unix-domain sockets and TCP/IP connections. I.e.: different entries in your pg_hba.conf file for local and host. Check the file and add lines for local accordingly.
Reload the server to have it take effect.
BTW.: I use pg_lsclusters on Debian for a quick check which db clusters are installed/running.