I experienced this issue when working with PostgreSQL on Ubuntu 18.04. # now postgresql starts! (and install command doesn't fail anymore) Sudo chmod 740 /etc/ssl/private/ssl-cert-snakeoil.key Sudo chown root:ssl-cert /etc/ssl/private/ssl-cert-snakeoil.key Run the below code to fix the user group issue and for fixing the permissions #set user to group back with It happened to me and it turned out that I removed erroneously the Postgres user from "ssl-cert" group. Make sure that postgres is the owner of /var/lib/postgresql/version_no/mainĮg: sudo chown postgres -R /var/lib/postgresql/9.6/main/ Step 5: Check postgres user belongs to ssl-cert user group Try adding `postgres` user to the group `ssl-cert` My error was(You can see the errors in the logs /var/log/postgresql/) FATAL: could not access private key file "/etc/ssl/private/ssl-cert-snakeoil.key": Permission denied If restarting pg_lsclusters was not successful, it will throw an error. If not restart PostgreSQL service Step 2: Restart the pg_ctlcluster #format is pg_ctlcluster Most probably the status will be down in your case. If there is no error in starting the Postgres service, follow these steps Step 1: Running pg_lsclusters will list all the Postgres clusters running on your deviceĮg: Ver Cluster Port Status Owner Data directory Log fileĩ.6 main 5432 online postgres /var/lib/postgresql/9.6/main /var/log/postgresql/ If you don't see it, you can modify the file, and restart the postgres service. If you can't find the socket, but see that the service is running, Verify that the pg_hba.conf file allows local sockets.īrowse to the datadir and you should find the pg_hba.conf file.īy default, near the bottom of the file you should see the following lines: # "local" is for Unix domain socket connections only Step 3: If the service is running but you don't see a socket Then, try connecting via psql using this file's location explicitly, eg. On my machine, it turned out to be: /tmp/.s.PGSQL.5432 If postgres is running and accepting socket connections, the above should tell you the location of the socket. Use find to search for the location of the socket, which should be somewhere in the /tmp sudo find /tmp/ -name. Step 2: If the postgres service is running man postgresįrom there, you'd see that the options -D and -r are respectively the datadir & the logfilename. You can look at all the options available to start the postgres server using the following. The last column shows the command used to start the server, and the options. On my system, mac osx, this spits out 501 408 1 0 2Jul15 ? 0:21.63 /usr/local/opt/postgresql/bin/postgres -D /usr/local/var/postgres -r /usr/local/var/postgres/server.log But on most *ix systems the following would work, it will search for postgres among all running processes ps -ef | grep postgres The command may vary depending on your operating system. Step 1: Verify that the database is running Either you don't have the database service running in the background, or the socket is located elsewhere, or perhaps the pg_hba.conf needs to be fixed. The error states that the psql utility can't find the socket to connect to your database server.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |