Thread: starting up database server + user postgres

starting up database server + user postgres

From
Jennifer Liu
Date:
Hi,

I'm a novice for using Postgres and Linux - any help or suggestions would be really appreciated, thanks!!!  I'm having
troublelogging on as the postgres user.  I wanted to 
create a database, so I tried...

root# /usr/local/pgsql/bin/createdb test
psql: 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"?
createdb: database creation failed

(so i thought i probably needed to logon as postgres, so i tried...)
root# su - postgres
su: user postgres does not exist

root# adduser postgres
adduser: group postgres exists - if you want to add this user to that group, use -g.

root# chown postgres /usr/local/pgsql/data
chown: `postgres': invalid user


I'm a little stuck....can anybody help?  thanks so much!

jenn.



Re: starting up database server + user postgres

From
Bruno Wolff III
Date:
On Mon, Sep 01, 2003 at 12:06:19 -0400,
  Jennifer Liu <jennliu@MIT.EDU> wrote:
> Hi,
>
> I'm a novice for using Postgres and Linux - any help or suggestions would be really appreciated, thanks!!!  I'm
havingtrouble logging on as the postgres user.  I wanted to 
> create a database, so I tried...
>
> root# /usr/local/pgsql/bin/createdb test
> psql: 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"?
> createdb: database creation failed

This suggests the postmaster hasn't been started.

Re: starting up database server + user postgres

From
Tom Lane
Date:
Jennifer Liu <jennliu@MIT.EDU> writes:
> root# /usr/local/pgsql/bin/createdb test
> psql: 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"?
> createdb: database creation failed

The PG postmaster isn't running, evidently.  You didn't say what Linux
distro you are using, so it's hard to give exact details about how to
start it, or to tell whether there's any preliminary setup you need to
do.  It seems odd that you have a postgres group but not a postgres
user, though.

> root# chown postgres /usr/local/pgsql/data
> chown: `postgres': invalid user

Is that directory already there?  If so, what user owns it?  That's
probably the user you want to start the postmaster as.

            regards, tom lane

Re: starting up database server + user postgres

From
"mathan"
Date:
> I'm a novice for using Postgres and Linux - any help or suggestions would
be really appreciated, thanks!!!  I'm having trouble logging on as the
postgres user.  I wanted to
> create a database, so I tried...
>
> root# /usr/local/pgsql/bin/createdb test
> psql: 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"?
> createdb: database creation failed
>
> (so i thought i probably needed to logon as postgres, so i tried...)
> root# su - postgres
> su: user postgres does not exist
>
> root# adduser postgres
> adduser: group postgres exists - if you want to add this user to that
group, use -g.
>
> root# chown postgres /usr/local/pgsql/data
> chown: `postgres': invalid user
>
>
> I'm a little stuck....can anybody help?  thanks so much!

Just run the following commands

# useradd postgres
# rm -rf /usr/local/pgsql/data
# mkdir /usr/local/pgsql/data
# chown postgres /usr/local/pgsql/data
#su - postgres

$ /usr/local/pgsql/bin/initdb -D /usr/local/pgsql/data

$ /usr/local/pgsql/bin/postmaster &

It will start the postgresql daemon

$ /usr/local/pgsql/bin/createdb test

$/usr/local/pgsql/bin/psql test

Then you enter into the databare test

thanks
--mathan



---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.491 / Virus Database: 290 - Release Date: 6/18/2003