Check if postgresql is running, run following cmd
root@DESKTOP:~# sudo /etc/init.d/postgresql start
10/main (port 5432): downThe output of the above cmd shows the postgresql version and port and status. So the status down means that the server is not running, lets start the server, use following command
root@DESKTOP:~# sudo /etc/init.d/postgresql startSo now you can connect to your postgresql. Inorder to stop the server use following command
* Starting PostgreSQL 10 database server
root@DESKTOX-QMQVNCE:~# sudo /etc/init.d/postgresql stop
* Stopping PostgreSQL 10 database server