data directory “/ usr / local / var / postgres” has invalid permissions

Fixing data directory error “/ usr / local / var / postgres” has invalid permissions.

Also, errors may look like this:

psycopg2.OperationalError: could not connect to server: No such file or directory
Is the server running locally and accepting
connections on Unix domain socket “/tmp/.s.PGSQL.5432”?

FATAL: data directory “/ usr / local / var / postgres” has invalid permissions

Probably there are problems with the rights to the directory, also if the directory does not exist or it has been moved and access rights have been violated.

To fix it, start fixing the rights:

chmod 0700 / usr / local / var / postgres

And we initialize the directory again:

initdb -D / usr / local / var / postgres

If postgreSQL still does not start on Mac OS, try manually running:

pg_ctl -D / usr / local / var / postgres -l /usr/local/var/postgres/server.log start

And further in the file server.log see what is the cause of the error.

Similar Posts

Leave a Reply

Your email address will not be published. Required fields are marked *