1

Please, I need help with my postgres server. I have problems starting the server. I was using the app here a few months ago and everything was fine. Today I spent hours trying to start it yet couldn't. I then realised I had another instance of PostgreSQL installed. I uninstalled version 9.6 blocking my app.

Now after trying again, the PostgreSQL app throws the error when I use psql:

FATAL:  role "username" does not exist

I didn't set the role or user but it somehow took my username and is throwing does not exist. Please, how do I start my server. I have seen someone with a similar issue here but unlike in his case, I didn't even get to start the server. not to speak of deleting the database. Please, how do I address this? Any help would be appreciated.

I also noticed he was able to execute

which psql

which returned his supposed psql path. It does not return anything in my case. Not sure how the configuration works, this is my second time using this database and it failed right away.

Community
  • 1
  • 1
Nuru Salihu
  • 4,756
  • 17
  • 65
  • 116
  • what happens when you run the command: psql -U postgres – d1ll1nger Aug 28 '16 at 21:32
  • If you get the error quoted, the server is running. `psql` by default uses your Unix username as the database user. You can override this with the `-U` command line option followed by the postgresql username you would like to use. – jcaron Aug 28 '16 at 22:07

1 Answers1

0

Thank you for your time, as answered in one of the SO question here. Running

sudo -u postgres -i

did give me access to postgres, but if you are using the postgres app like myself here . Running psql commands would not work for you as postgres is not installed globally on your machine. But running

'/Applications/Postgres.app/Contents/Versions/9.5/bin'/psql -p5432 which is the exact command the postgres app execute when you attempt to start the service works great and start the service for me. You can then proceed and add the role and database your postgres app looks for by default. So in summary. Below is what worked for me.

$sudo -u postgres -i
$'/Applications/Postgres.app/Contents/Versions/9.*/bin'/psql -p5432
#CREATE USER postgres SUPERUSER;
#CREATE DATABASE postgres WITH OWNER postgres;
Nuru Salihu
  • 4,756
  • 17
  • 65
  • 116