AssanSav
AssanSav

Reputation: 41

postgresql error up when running sudo service postgresql start under Ubuntu 20.04

As a PostgreSQL newbie user, I am getting this error below, when running sudo service postgresql start.

    * Starting PostgreSQL 12 database server                                                             * Error: /usr/lib/postgresql/12/bin/pg_ctl /usr/lib/postgresql/12/bin/pg_ctl start -D /var/lib/postgresql/12/main -l /var/log/postgresql/postgresql-12-main.log -s -o  -c config_file="/etc/postgresql/12/main/postgresql.conf"  exited with status 1: 
2020-10-01 15:58:42.129 EDT [6750] LOG:  starting PostgreSQL 12.4 (Ubuntu 12.4-0ubuntu0.20.04.1) on x86_64-pc-linux-gnu, compiled by gcc (Ubuntu 9.3.0-10ubuntu2) 9.3.0, 64-bit
2020-10-01 15:58:42.131 EDT [6750] LOG:  could not bind IPv4 address "127.0.0.1": Permission denied
2020-10-01 15:58:42.131 EDT [6750] HINT:  Is another postmaster already running on port 5432? If not, wait a few seconds and retry.
2020-10-01 15:58:42.131 EDT [6750] WARNING:  could not create listen socket for "localhost"
2020-10-01 15:58:42.131 EDT [6750] FATAL:  could not create any TCP/IP sockets
2020-10-01 15:58:42.132 EDT [6750] LOG:  database system is shut down
pg_ctl: could not start server
Examine the log output.

Upvotes: 1

Views: 670

Answers (1)

AssanSav
AssanSav

Reputation: 41

The issue was because I installed postgresql without specifying the version so uninstalling and reinstalling with the version specified fixed the issue

To uninstall

sudo apt-get remove --purge postgresql-12

and then to reinstall

sudo apt-get install postgresql-12

Upvotes: 1

Related Questions