createdb: could not connect to database

Поиск
Список
Период
Сортировка
Искать

createdb: could not connect to database

От:
Paul Smith <phhs80@gmail.com>
Дата:
Dear All

I have just installed postgres 8.1.2 on a computer running Fedora Core
4 with the rpms got from postgres site. However, I get the following:


$ createdb mydb
createdb: could not connect to database postgres: could not connect to
server: No such file or directory
        Is the server running locally and accepting
        connections on Unix domain socket "/tmp/.s.PGSQL.5432"?
$

Any idea about how to overcome the problem?

Thanks in advance,

Paul

Re: createdb: could not connect to database

От:
Devrim GUNDUZ <devrim@commandprompt.com>
Дата:
Hi,

On Sat, 2006-02-04 at 17:34 +0000, Paul Smith wrote:

> I have just installed postgres 8.1.2 on a computer running Fedora Core
> 4 with the rpms got from postgres site. However, I get the following:
> 
> 
> $ createdb mydb
> createdb: could not connect to database postgres: could not connect to
> server: No such file or directory
>         Is the server running locally and accepting
>         connections on Unix domain socket "/tmp/.s.PGSQL.5432"?
> $
> 
> Any idea about how to overcome the problem?

Did you start postgresql service?

# service postgresql start

Regards,
-- 
The PostgreSQL Company - Command Prompt, Inc. 1.503.667.4564
PostgreSQL Replication, Consulting, Custom Development, 24x7 support
Managed Services, Shared and Dedicated Hosting
Co-Authors: plPHP, plPerlNG - http://www.commandprompt.com/

Re: createdb: could not connect to database

От:
Paul Smith <phhs80@gmail.com>
Дата:
On 2/4/06, Devrim GUNDUZ  wrote:
> Did you start postgresql service?
>
> # service postgresql start

Thanks, Devrim. After "service postgresql start", I get

$ createdb mydb
createdb: could not connect to database postgres: FATAL:  role
"psmith" does not exist
$

Paul

Re: createdb: could not connect to database

От:
Devrim GUNDUZ <devrim@commandprompt.com>
Дата:
Hi,

On Sat, 2006-02-04 at 17:56 +0000, Paul Smith wrote:

> Did you start postgresql service?
> >
> > # service postgresql start
> 
> Thanks, Devrim. After "service postgresql start", I get
> 
> $ createdb mydb
> createdb: could not connect to database postgres: FATAL:  role
> "psmith" does not exist
> $

- By default, RPM installations use ident authentication. This basically
means that you must be postgres user to access to PostgreSQL. First su
to root, and the su to postgres and run createdb then. (you cannot
directly su to postgres since it does not have an initial password)

- You can also edit pg_hba.conf to allow access to regular users:
http://www.postgresql.org/docs/8.1/static/client-
authentication.html#AUTH-PG-HBA-CONF

- You can create psmith role and allow access to that user.

Regards,
-- 
The PostgreSQL Company - Command Prompt, Inc. 1.503.667.4564
PostgreSQL Replication, Consulting, Custom Development, 24x7 support
Managed Services, Shared and Dedicated Hosting
Co-Authors: plPHP, plPerlNG - http://www.commandprompt.com/

Re: createdb: could not connect to database

От:
Andreas Kretschmer <akretschmer@spamfence.net>
Дата:
Paul Smith  schrieb:

> On 2/4/06, Devrim GUNDUZ  wrote:
> > Did you start postgresql service?
> >
> > # service postgresql start
> 
> Thanks, Devrim. After "service postgresql start", I get
> 
> $ createdb mydb
> createdb: could not connect to database postgres: FATAL:  role
> "psmith" does not exist
> $

Create a database user:
Become root with su, then 'su - postgres', then createuser.

Read & edit the file 'pg_hba.conf'

http://www.postgresql.org/docs/current/static/client-authentication.html#AUTH-PG-HBA-CONF


HTH, Andreas
-- 
Really, I'm not out to destroy Microsoft. That will just be a completely
unintentional side effect.                              (Linus Torvalds)
"If I was god, I would recompile penguin with --enable-fly."    (unknow)
Kaufbach, Saxony, Germany, Europe.              N 51.05082°, E 13.56889°

Re: createdb: could not connect to database

От:
Paul Smith <phhs80@gmail.com>
Дата:
On 2/4/06, Andreas Kretschmer  wrote:
> Paul Smith  schrieb:
>
> > On 2/4/06, Devrim GUNDUZ  wrote:
> > > Did you start postgresql service?
> > >
> > > # service postgresql start
> >
> > Thanks, Devrim. After "service postgresql start", I get
> >
> > $ createdb mydb
> > createdb: could not connect to database postgres: FATAL:  role
> > "psmith" does not exist
> > $
>
> Create a database user:
> Become root with su, then 'su - postgres', then createuser.
>
> Read & edit the file 'pg_hba.conf'
>
> http://www.postgresql.org/docs/current/static/client-authentication.html#AUTH-PG-HBA-CONF

Thanks, Andreas and Devrim. Now, I have postgres working fine here!

Paul
FAQ