Thread: Problem with starting up

Problem with starting up

From
"Nandu Garg"
Date:
Hi All

I am new to pgsql and just now started with it. It is installed on our Linux Machine.
I am referring an online Doc and doing things. Now I have following prblems at my level.

when I issue following command at my prompt It gives me following error
$psql
Connection to database 'amol' failed.
FATAL 1:  Database amol does not exist in pg_database

When I issued following command
$createdb mydb
Connection to database 'template1' failed.
FATAL 1:  SetUserId: user 'amol' is not in 'pg_shadow'

'amol' is my actual user on linux. Now What can be the problem.. Also let me know what are the starting command on
Linuxfor pgsql.
 
Do I have to connect using 'postgres' user ..what is the password by default

Amol


Re: Problem with starting up

From
Holger Krug
Date:
On Fri, Jan 11, 2002 at 11:35:12AM -0000, Nandu  Garg wrote:

> when I issue following command at my prompt It gives me following error
> $psql
> Connection to database 'amol' failed.
> FATAL 1:  Database amol does not exist in pg_database

If you do not give a database name, your user name is taken as default. psql
tries to connect to database 'amol' and fails.

> When I issued following command
> $createdb mydb
> Connection to database 'template1' failed.
> FATAL 1:  SetUserId: user 'amol' is not in 'pg_shadow'

If your Linux system is correctly installed `man createdb' should give
you all the necessary information. For creating new databases you have
to be a valid PostgreSQL user with CREATE DATABASE permission.
Initially there is only one user, named `postgres'. So calling

$ createdb -U postgres newdb

should work fine. (But look at the man page first!)

To create a new user, e.g. yourself, look at `man createuser' and `man
create_user'. E.g. the following should work fine:

$ psql -U postgres newdb
newdb=# CREATE USER amol;
CREATED
newdb=# \q
$ psql newdb       # now you can connect as yourself !

> Do I have to connect using 'postgres' user ..what is the password by default

No password by default.

--
Holger Krug
hkrug@rationalizer.com

Re: Problem with starting up

From
"Nick Fankhauser"
Date:
Amol-

Answers to your several questions:


> $psql Connection to database 'amol' failed. FATAL 1:  Database
> amol does not exist in pg_database

This message simply means the database doesn't exist yet.



> command $createdb mydb Connection to database 'template1' failed.
> FATAL 1:  SetUserId: user 'amol' is not in 'pg_shadow'

This looks like the heart of your problem. You need to set your linux user
to postgres ("su - postgres" from root), and do a "createuser amol" if you
want to use the databse from your account.




> do I
> have to connect using 'postgres' user ..what is the password by
> default

Generally, by default the authorization method is "peer sameuser" after
initial install, meaning that if you are logged into linux as a user that
exists in pg_shadow, you are authorized. the user "postgres" is initially
there, so just su to postgres while you create other user accounts using
createuser. Later you may want to choose a more secure auth method. Search
the interactive documentation for "pg_hba.conf" to learn more about
authorization methods & how to set them.

Hope this helps you get started! Welcome to postgresql.

-Nick

--------------------------------------------------------------------------
Nick Fankhauser  nickf@ontko.com  Phone 1.765.935.4283  Fax 1.765.962.9788
Ray Ontko & Co.     Software Consulting Services     http://www.ontko.com/