From: | Alan Hodgson <ahodgson(at)simkin(dot)ca> |
---|---|
To: | pgsql-novice(at)postgresql(dot)org |
Subject: | Re: Linux Users vs PostgreSQL Users |
Date: | 2015-11-11 02:45:07 |
Message-ID: | 2246101.YixKdnZjFQ@skynet.simkin.ca |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-novice |
On Tuesday, November 10, 2015 05:45:51 PM you wrote:
> Thanks Alan & Felipe. So, in the following line, what does the last
> "postgres" do and is it necessary?
>
> sudo -u postgres psql postgres
>
> Source: 1st answer at
> http://serverfault.com/questions/110154/whats-the-default-superuser-username
> -password-for-postgres-after-a-new-install
>
> Wouldn't this be the same?
>
> sudo -u postgres psql
The second postgres tells psql which database to connect to. There is by
default one named postgres. And yes it is redundant in this case, as I believe
psql tries to connect to a database named after the user you connect as, if
you don't otherwise specify the database name.
So in this case you have a system user called postgres, a PostgreSQL role
called postgres, and a default database called postgres, all coming into play,
which is probably a little confusing at first.
From | Date | Subject | |
---|---|---|---|
Next Message | Alan Hodgson | 2015-11-17 02:26:57 | Re: [pgsql-novice] Daily digest v1.3706 (6 messages) |
Previous Message | Michael Convey | 2015-11-11 01:45:51 | Re: Linux Users vs PostgreSQL Users |