Thought it will be usefull for some new users of postgreSQl.
1.Create a Solaris OS user and group that will be used to administer PostgreSQL.
Note: PostgreSQL cannot be run as root user.
# groupadd postgres
# useradd -c 'PostgreSQL user' -d /export/home/postgres -g postgres -m -s /bin/bash postgres
2. The next step is to decide on a directory to create the database and ensure that the permissions are set correctly.
To use the default directory with the Solaris user called "postgres", execute the following commands to set the ownership and permissions:
# chown postgres /var/lib/pgsql/data
# chmod 700 /var/lib/pgsql/data
3. You are now ready to create a database.Login as "postgres" and execute the initdb command.
To create a database in /var/lib/pgsql/data, execute the following command:
$ initdb -D /var/lib/pgsql/data
4.PostgreSQL is now ready to be started using the following command:
$ pg_ctl -D /var/lib/pgsql/data -l postmaster.log start
or you can simply start
$ pg_ctl -D /var/lib/pgsql/data start
Or you can start the database server with
$postmaster -D /var/lib/pgsql/data
5.You can now test the running database.
To connect to a database called "postgres" running on a default port, execute the following command:
$ psql postgres
thats all and now you can use the database with all your SQL knowledge.
cheers
Comments:

Post a Comment:
Comments are closed for this entry.

This blog copyright 2008 by pnayak