- create a new useraccount where you are going to run postgresql (for example pgsql).
- Link /usr/sepp/var/postgresql-8.1.4-to/data.HOSTNAME to a place where you want to keep you actual datastore
- run /usr/pack/postgresql-8.1.4-to/sun4u-sun-solaris2.8/bin/initdb --pgdata
/usr/sepp/var/postgresql-8.1.4-to/data --pwprompt to setup the
database structure. Note, the password gets stored in CLEARTEXT
... the name of the superuser is the name of the user the postgresql
daemon is running under.
- edit the security setup in
/usr/sepp/var/postgeresql-8.1.4-to/data/pg_hba.conf and replace
trust with md5 (or crypt if the passwords are stored in this format).
DB Administration: How to create a new Database
- pg_ctl -o "-i" start
(the add '-o "-i"' enables intenet accessability of the db) otherwhise you
can only access it locally
- create an admin user for this new database with appropriate rights.
This will require you to login with an account which can create users.
/usr/pack/postgresql-7.3.5-to/bin/createuser --username=pgsql --password --createdb --pwprompt newadmin
- use the new account to create a database as this new user. This will allow
it to create tables in 'his' db.
/usr/pack/postgresql-8.1.4-to/sun4u-sun-solaris2.8/bin/createdb --username=newadmin --password newdb
- optionally you can now log in a pgsql (master user) again and remove the
database creation priviledge from this user
- run psql -h dbhost to connect to the postgresql server
local all trust
- When upgrading a database from previous postgresql versions you must
dump the contents of the database to a file and restore this in the
new database. Note that in order for pg_dumpall to work you may
have to edit the pg_hba.conf file and allow the postgresql root user
to use all local databases without password.
- You can restore the output of pg_dumpall by feeding it to psql.
- You might have to play with the permissions as well.
To access the perlbindings, use the following line in your script
use lib qw(/usr/pack/postgresql-8.1.4-to/lib/perl);
See the POD documentation.