Yesterday I formatted the computer with Debian and I need to continue in my projects but I have not been able to use postgresql again, in the terminal I used:
caro@caro-pc:~$ sudo apt-get install postgresql postgresql-client postgresql-contrib libpq-dev
caro@caro-pc:~$ psql --version
psql (PostgreSQL) 9.5.0
But I don't remember what other steps follow, since if I do the following:
caro@caro-pc:~$ sudo-i -u postgres
postgres@caro-pc:~$ psql -V
I get:
psql (PostgreSQL) 9.5.0
But if I do, for example:
postgres@caro-pc:~$ psql -l
I get:
psql: no se pudo conectar con el servidor: No existe el fichero o el directorio
¿Está el servidor en ejecución localmente y aceptando conexiones en el socket de dominio Unix «/var/run/postgresql/.s.PGSQL.5432»?
Please can you help me? Do I have to edit any configuration files?
Well, in case the option
-V
is just a flag to display the version, no connection to the server is needed:The flag
-l
shows you the list of available databases, so you necessarily need to have a connection to the server.What you can do is make sure the service is up:
If you don't get results you just need to raise the service:
Update
For security reasons, Postgres does not allow remote connections. If you want to enable them you have to do the following:
In the config file
pg_hba.conf
, add (example network):In the configuration file
postgresql.conf
, you have to use:Restart the service:
I recommend you use the web interface: http://phppgadmin.sourceforge.net/doku.php