[csw-users] postgres usage?

Mark Round mark at markround.com
Wed Jun 2 10:44:47 CEST 2004


Hi!

First thing - make sure you have the latest version of PostgreSQL 
(7.3.6,REV=2004.05.27). You can do this with :-

# pkg-get -U
# pkg-get -u postgresql

There was a bug on a previous release that prevented it from working 
properly.

When postgresql initialises (via the "initdb" argument to the 
cswpostgresql init wrapper), all it does is create a "blank" database 
directory - this is like running mysql_install_db.

You specify the user with the -U flag. So, to verify postgres is running 
and you can connect, try the following :-

# psql -U postgres template1

You should then be at the psql prompt, with the database "template1" 
open (\? gives help). First thing to do, is set a password for your 
"postgres" user :-

template1=# ALTER USER postgres WITH PASSWORD '<your password here>';

Log out of the psql interface with \q. Now, modify your 
/opt/csw/var/pgdata/pg_hba.conf file to not accept connections without a 
password - change the "trust" values to "password" in the METHOD field. 
Restart postgresql, and it won't let you in without a password.

Now, start psql up again as before, enter your password for the postgres 
user, and create a regular user :-

template1=# CREATE USER newuser WITH PASSWORD '<your password here>';

And you should be good to go, There is also a shell script called 
"createuser" that you can run that makes adding users easy. See the 
documentation for more information on creating new databases and 
granting privileges to new users...

-Mark

Gerard Henry wrote:

>hello,
>i just installed postgres for the first time from blastwave, and it says that server is successfully started at the end of install, but there is nothing about connect to the base?!
>before using postgres, i only use mysql...
>but with postgres, how can i connect to the database to administer? if i type psql:
>hobbit-henry% psql -l
>psql: FATAL:  user "henry" does not exist
>
>How can i create a database? the script /etc/init.d/cswpostgres init
>seems to create a database, but what is name?
>
>Thanks in advance for your help,
>
>  
>




More information about the users mailing list