How to restart PostgreSQL server?

To restart the PostgreSQL server, you can use the following commands depending on your operating system:

On Ubuntu/Debian:

  1. Open your terminal.

  2. Run the following command:

    sudo systemctl restart postgresql
    

On CentOS/RHEL:

  1. Open your terminal.

  2. Run the following command:

    sudo systemctl restart postgresql
    

Using pg_ctl:

If you prefer using pg_ctl, you can do it like this:

  1. Open your terminal.

  2. Run the following command (replace version with your PostgreSQL version):

    pg_ctl -D /var/lib/postgresql/version/main restart
    

Make sure to check the status after restarting to confirm that the server is running:

pg_isready

This will help you verify that the PostgreSQL server has restarted successfully.

0 Comments

no data
Be the first to share your comment!