Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 18 Jan 2001 13:24:03 -0500
From:      Carroll Kong <damascus@home.com>
To:        Francisco Reyes <lists@reyes.somos.net>
Cc:        freebsd-database@FreeBSD.ORG
Subject:   Re: Need help with PostgreSQL database
Message-ID:  <4.2.2.20010118131827.00c82d50@netmail.home.com>
In-Reply-To: <Pine.BSF.4.21.0101180103320.13287-100000@zoraida.reyes.som os.net>

next in thread | previous in thread | raw e-mail | index | archive | help
At 01:05 AM 1/18/01 -0500, Francisco Reyes wrote:
>I installed PostgresSQL from ports. I am trying to access any database or
>to create a new one, without much luck.
>
>I noticed the port made a user called pgsql. Am I supposed to use this?
>I tried using that user by becoming root and then that user. Then I tried
>psql.
>
>It complained about database "psql" not existing. If I try "psql test" it
>gives me read access denied.
>
>Any hints on getting PosgreSQL going on FreeBSD?
>I bought a book and I am looking at the tutorial, but before I can use
>them I need to be able to create a database or use the "test" database.

I had trouble with PostgreSQL on FreeBSD before since I did not know where 
to look.  I cannot quite remember where else to look for except the 
PostgreSQL documentation on their website.

man psql (you will most likely need to add the postgresql man pages in your 
man path for this to succeed) tells you that by default you will end up 
creating a db after your own name if you just run psql.  You can pass a 
parameter that lets you choose another db.  Conversely, you can setup an 
environment variable that always chooses a particular db, or even a user!

PGDATABASE=yourdb
PGUSER=dbuser

To create a db, take a look at the /usr/local/pgsql/bin.  That is where all 
the db specific binaries are held.  createdb will help create a new 
db.  There are parameters there to create a db under the name of another 
user.  You might want to add a new user before that begins.  Just get into 
the test database.

"psql test"

Use the create user command to make a subordinate user and then create a db 
under his name, and you should be set to go.

-Carroll Kong



To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-database" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?4.2.2.20010118131827.00c82d50>