Totally new to postgresql; just had it installed (version 14.1) for the first time via brew on m1 Mac. Installation works fine, but I thought the installation process shall also create a superuser called 'postgres' but when trying to connect to PostgreSql as 'postgres' using
sudo -u postgres psql
It says unknown user: postgres
What am I missing here?
CodePudding user response:
Try to log in with your current user. Here my output
~ $ whoami
macbook
~ $ psql
psql (13.3)
Type "help" for help.
macbook=# select * from user;
user
---------
macbook
(1 row)
macbook=#
So postgresql create macbook
user, as my username in system.
I have MacOS Big Sur 11.6 and postgresql13.3.
CodePudding user response:
"unknown user: postgres" looks like a sudo error message (or a fragment of one), not a PostgreSQL error message. It is complaining about the OS user named postgres, not the database user with the same spelling. You don't know if the database user of that name exists or not, as you haven't gotten far enough to tell.
What the installation method does depends on what the installation method was, which you haven't told us.