Default Postgres Password
ryandesign at macports.org
Sun Nov 25 14:32:06 PST 2012
On Nov 25, 2012, at 16:12, Stephen Rasku <macports at srasku.net> wrote:
> On Sun, Nov 25, 2012 at 1:27 PM, Brandon Allbery <allbery.b at gmail.com> wrote:
>> On Sun, Nov 25, 2012 at 3:58 PM, Stephen Rasku <macports at srasku.net> wrote:
>>> It's asking me for a password when I do that.
>> Not directly; wrap it in sudo, since root can then su to any user without a password.
> I did "sudo psql90" and it still asked me for a password:
> $ sudo psql90
> psql90: FATAL: password authentication failed for user "root"
> $ sudo psql90 -U postgres
> Password for user postgres:
> psql90: FATAL: password authentication failed for user "postgres"
I am not familiar with PostgreSQL, but Brandon said to wrap the "su" command in "sudo", as in "sudo su postgres". That will prompt you for your regular system user's password, and assuming your regular system user is an administrative user, will switch you to the postgres system user, without you needing to know the postgres system user's password*. Then you can run further commands, such as "psql90", and it will run as the postgres system user. When done impersonating the postgres system user, you can "exit" to get back to your regular system user.
* in fact, the postgres system user probably doesn't even have a password set, nor allow any logins at all
More information about the macports-users