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

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

  • 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 '16 at 10:30

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".

| improve this answer | |

On Centos 7 you should use systemctl. Ex.:

/bin/systemctl stop postgresql
| improve this answer | |

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

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.