23

I have installed PostGreSQL 8.3 on an Ubuntu machine and I want to configure a pssw for it, however when I run this command:

sudu su postgres -c psql template1

I get the following 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"?"

Can anybody tell me how I can check if the db server is running locally (only accepting connections on localhost)?

How I can start the psql server?

I'm a Linux newbie, btw

6 Answers 6

26

You can know the status of your Postgres server via the command

sudo /etc/init.d/postgresql-8.3 status

To start it you can issue the command

sudo /etc/init.d/postgresql-8.3 start

and to stop you can issue the command

sudo /etc/init.d/postgresql-8.3 stop
2
  • so it was down, attempting to start it, it says it cannot load file server.cert? Commented Jul 11, 2010 at 11:04
  • 2
    This happens when postgres ssl is turned on and the certificates is not there. What you can do is open the file /etc/postgresql/8.3/main/postgresql.conf ,there is a line when says ssl = true change that to ssl = false and then start your serevr
    – proy
    Commented Jul 11, 2010 at 11:24
22

First, check whether the server is running or not. The command for checking this is:

service postgresql status

it will check the status of server if you found

postgresql.service - PostgreSQL RDBMS

Loaded: loaded (/lib/systemd/system/postgresql.service; disabled; vendor pres

Active: inactive (dead)

Then you have to restart the server by the given command and mostly this problem is coming in 9.6.1 version of PostgreSQL.

service postgresql restart

Then the PostgreSQL server will run correctly in Ubuntu terminal

1

You can also start and stop postgres server without specifying version:

/etc/init.d/postgresql start

start - to start server

stop - to stop server

status - to know status, whether server is running or not

1

Most Recent

To check if it is running:

sudo systemctl status postgresql@13-main

To start it:

sudo systemctl start postgresql@13-main

0
systemctl status postgresql

was what I was looking for

0

It is actually

sudo systemctl status postgresql@13-main

where 13 is your installed postgres version. To actually check for your postgres version, you will have to open a postgres interface. For example like this:

sudo -u postgres psql

and execute

select version()

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .