5

How does one stop a Postgresql instance, 9.2, on CentOS 7.

I found nothing under /etc/init.d/ nor a ctl program.

1
  • 1
    if you don't enjoy to type postgresql version each time, and if you have just one postgresql instance running, you can systemctl stop postgresql*
    – lese
    Mar 3, 2016 at 10:30

3 Answers 3

18

Welcome to the world of systemd

Try something like:

service postgresql-9.2 stop

If that does not work, try to find the correct servicename:

systemctl list-units|grep postgresql

And retry above command with the part of the result just before the ".service".

8

On Centos 7 you should use systemctl. Ex.:

/bin/systemctl stop postgresql
1

on CentOS7:

  1. definitely 'run systemctl list-units|grep postgresql' 1st and get the full name of the service
  2. 'systemctl stop postgresql-??.service'
  3. 'su - postgres -c "psql"'

  4. and you should get confirmation postgres has in fact stopped:

'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"?'

You must log in to answer this question.

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