Thread: How to connect to the database server

How to connect to the database server

From
guillaume.yziquel@free.fr
Date:
Hello list.

My problem is the following: I've installed a postgresql server on my debian
GNU/linux system. I've not installed for postgresql itself, but rather because I
needed a database server for other applications that use the database for
storage purposes.

Usually, using aptitude is always a pleasure... However, I now have a database
server and I do not have any more the credentials to access the database as the
database administrator (or perhaps I have them somewhere, but I'm unable to find
them again).

My question is the following: How can I get to connect directly to the database
as the database superuser? Do I need to delete and reinstall my whole database?

I've been looking for documentation on this topic, but perhaps in the wrong
placem or perhaps in the right but failing to see the light... So if you have a
relevant link, I'm dying to hear about it.

Guillaume.

Re: How to connect to the database server

From
"Harold A. Giménez Ch."
Date:
Have you tried loging in with the default user (postgres)?

psql -U postgres

or, try su'ing as postgres and login in then:

su - postgres<enter>
psql<enter>

On Thu, May 22, 2008 at 1:14 PM, <guillaume.yziquel@free.fr> wrote:
Hello list.

My problem is the following: I've installed a postgresql server on my debian
GNU/linux system. I've not installed for postgresql itself, but rather because I
needed a database server for other applications that use the database for
storage purposes.

Usually, using aptitude is always a pleasure... However, I now have a database
server and I do not have any more the credentials to access the database as the
database administrator (or perhaps I have them somewhere, but I'm unable to find
them again).

My question is the following: How can I get to connect directly to the database
as the database superuser? Do I need to delete and reinstall my whole database?

I've been looking for documentation on this topic, but perhaps in the wrong
placem or perhaps in the right but failing to see the light... So if you have a
relevant link, I'm dying to hear about it.

Guillaume.

--
Sent via pgsql-novice mailing list (pgsql-novice@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-novice

Re: How to connect to the database server

From
guillaume.yziquel@free.fr
Date:
Selon Guillaume Yziquel <guillaume.yziquel@bluebottle.com>:

> Harold A. Gim�nez Ch. a �crit :
> > Have you tried loging in with the default user (postgres)?
> >
> > psql -U postgres
> >
> > or, try su'ing as postgres and login in then:
> >
> > su - postgres<enter>
> > psql<enter>


Hello, Harold.

I thank you very much for your answer.

psql -U postgres yields:

> yziquel@seldon:~$ psql -U postgres
> psql: impossible de se connecter au serveur: Permission non accord�e
>         Est-ce que le serveur tourne sur l'h�te local
>         et accepte des connexions au socket Unix �
/var/run/postgresql/.s.PGSQL.5432 �?

Doing su - postgres and psql yields:

> postgres@seldon:~$ psql
> psql: FATAL:  La base de donn�es � postgres � n'existe pas
> postgres@seldon:~$

Seems like I need to know what are the databases inside my cluster...

Thanks again for your help.

Guillaume.


> > On Thu, May 22, 2008 at 1:14 PM, <guillaume.yziquel@free.fr
> > <mailto:guillaume.yziquel@free.fr>> wrote:
> >
> >     Hello list.
> >
> >     My problem is the following: I've installed a postgresql server on
> >     my debian
> >     GNU/linux system. I've not installed for postgresql itself, but
> >     rather because I
> >     needed a database server for other applications that use the
> >     database for
> >     storage purposes.
> >
> >     Usually, using aptitude is always a pleasure... However, I now have
> >     a database
> >     server and I do not have any more the credentials to access the
> >     database as the
> >     database administrator (or perhaps I have them somewhere, but I'm
> >     unable to find
> >     them again).
> >
> >     My question is the following: How can I get to connect directly to
> >     the database
> >     as the database superuser? Do I need to delete and reinstall my
> >     whole database?
> >
> >     I've been looking for documentation on this topic, but perhaps in
> >     the wrong
> >     placem or perhaps in the right but failing to see the light... So if
> >     you have a
> >     relevant link, I'm dying to hear about it.
> >
> >     Guillaume.


Re: How to connect to the database server

From
"Greg Cocks"
Date:
What am I missing? When you installed PostgreSQL you set the passwords,
etc as part of the installation process, no?

If you have not started to populate the database yet, how about
uninstalling, rebooting, and then reinstalling with a note made of your
password and other settings?

Regards,
GREG COCKS
gcocks@stoller.com


-----Original Message-----
From: guillaume.yziquel@free.fr [mailto:guillaume.yziquel@free.fr]
Sent: Thursday, May 22, 2008 12:46 PM
To: harold.gimenez@gmail.com
Cc: pgsql-novice@postgresql.org
Subject: Re: [NOVICE] How to connect to the database server

Selon Guillaume Yziquel <guillaume.yziquel@bluebottle.com>:

> Harold A. Gimnez Ch. a crit :
> > Have you tried loging in with the default user (postgres)?
> >
> > psql -U postgres
> >
> > or, try su'ing as postgres and login in then:
> >
> > su - postgres<enter>
> > psql<enter>


Hello, Harold.

I thank you very much for your answer.

psql -U postgres yields:

> yziquel@seldon:~$ psql -U postgres
> psql: impossible de se connecter au serveur: Permission non accorde
>         Est-ce que le serveur tourne sur l'hte local
>         et accepte des connexions au socket Unix
/var/run/postgresql/.s.PGSQL.5432 ?

Doing su - postgres and psql yields:

> postgres@seldon:~$ psql
> psql: FATAL:  La base de donnes  postgres  n'existe pas
> postgres@seldon:~$

Seems like I need to know what are the databases inside my cluster...

Thanks again for your help.

Guillaume.


> > On Thu, May 22, 2008 at 1:14 PM, <guillaume.yziquel@free.fr
> > <mailto:guillaume.yziquel@free.fr>> wrote:
> >
> >     Hello list.
> >
> >     My problem is the following: I've installed a postgresql server
on
> >     my debian
> >     GNU/linux system. I've not installed for postgresql itself, but
> >     rather because I
> >     needed a database server for other applications that use the
> >     database for
> >     storage purposes.
> >
> >     Usually, using aptitude is always a pleasure... However, I now
have
> >     a database
> >     server and I do not have any more the credentials to access the
> >     database as the
> >     database administrator (or perhaps I have them somewhere, but
I'm
> >     unable to find
> >     them again).
> >
> >     My question is the following: How can I get to connect directly
to
> >     the database
> >     as the database superuser? Do I need to delete and reinstall my
> >     whole database?
> >
> >     I've been looking for documentation on this topic, but perhaps
in
> >     the wrong
> >     placem or perhaps in the right but failing to see the light...
So if
> >     you have a
> >     relevant link, I'm dying to hear about it.
> >
> >     Guillaume.


--
Sent via pgsql-novice mailing list (pgsql-novice@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-novice

Re: How to connect to the database server

From
Tom Lane
Date:
guillaume.yziquel@free.fr writes:
> Doing su - postgres and psql yields:

>> postgres@seldon:~$ psql
>> psql: FATAL:  La base de donn�es � postgres � n'existe pas
>> postgres@seldon:~$

> Seems like I need to know what are the databases inside my cluster...

"psql -l" would tell you, though I bet the answers is "template1".
What you probably want to do is "psql template1" as postgres,
then create some users corresponding to the Unix accounts you
normally want to connect from.

You might also want to change the default authentication mode,
which is probably "ident" right now.  Depending on what you're
doing, it might be better to give all the users passwords and
switch to md5 (ie, password) auth.

BTW, if the PG version doesn't create database "postgres" by
default, that means it's old enough to be obsolete.

            regards, tom lane

Re: How to connect to the database server

From
guillaume.yziquel@free.fr
Date:
> Tom Lane a écrit :
> >
> > "psql -l" would tell you, though I bet the answers is "template1".
> > What you probably want to do is "psql template1" as postgres,
> > then create some users corresponding to the Unix accounts you
> > normally want to connect from.
> >
> > You might also want to change the default authentication mode,
> > which is probably "ident" right now.  Depending on what you're
> > doing, it might be better to give all the users passwords and
> > switch to md5 (ie, password) auth.
> >
> > BTW, if the PG version doesn't create database "postgres" by
> > default, that means it's old enough to be obsolete.
> >
> >             regards, tom lane

Thanks Tom, thanks Harold.

I'm now back on tracks.

Concerning obsolete versions, yep, it's obsolete. Using package postgresql-7.4
from my debian distribution.

Thanks again.

Guillaume.