Restart PostgreSQL in Ubuntu 18.04

This brief article shows how to restart PostgreSQL in Ubuntu.

Restarting PostgreSQL Server in Ubuntu

You can use the following command to restart the Postgres server in Ubuntu.

Command:

sudo service postgres restart

Sometimes the above command doesn’t work. The problem might arise that stuck in clustering after reboot.

To fix this issue, you can perform the following command.

Command:

sudo systemctl restart postgresql.service

If you want to automatically start the while boot up the Ubuntu, use the command below.

Command:

 sudo systemctl enable postgresql
Write for us
DelftStack articles are written by software geeks like you. If you also would like to contribute to DelftStack by writing paid articles, you can check the write for us page.