You are here Home » Tech » Fix PostgreSQL Not Starting, Restarting After Updating, Reboot or Reinstallation

Fix PostgreSQL Not Starting, Restarting After Updating, Reboot or Reinstallation

by Fahad Saleem

PostgreSQL is one of the most advanced open source database resources used by programmers, database administrators, app developers and system administrator around the world. But recently, many users have reported a problem, according to which PostgreSQL won’t start. It doesn’t start or restart after updates on Mac, Windows and other operating systems. Homebrew postgres is also not starting after uninstallation, reboot or reinstallation.

Many users have complained that when they install Postgresql via homebrew, everything works fine until the system is rebooted or restarted. The complete instances of postgres stop running.

Here is the log error message faced by many people.

postgres cannot access the server configuration file “/usr/local/var/postgres/postgresql.conf”: No such file or directory

Here are a few solutions in order to fix PostgresSQL not starting, restarting in Mac, Windows or any other operating system.

The first solution is to make sure that /usr/local/var/postgres/postmaster.pid does not exist anymore before restarting the server. Why? Because the file remains on the disk and acts as a lock on a global scope through the system. It should be deleted.

On a crash instead of a regular shutdown, this file will remain on disk. It acts as a global lock.

Make sure that the database is initialized in /usr/local/var/postgres/, in order to avoid no progress in postgresql.conf or pg_hba.conf. If this directory is empty, that means you have a wrong location for your Pg datadir or you’ve removed it. You need to make a new DB with the initdb command.

Check out this github thread which examines this problem in detail. A pro-user has given the detailed analysis of the cause of the problem and fix looking at the documentation of the PostgreSQL. You might also be interested in learning more about Postgres Full Text Search.

You may also like