Let’s get started. I’ve installed Postgresql 8.4 through apt-get.
The first step I do is to change the password of ‘postgres’ user.
Run the command on root shell.
And I usually allow remote access into my Postgresql database. So, I have to edit the file ‘/etc/postgresql/8.4/main/pg_hba.conf’ by seeing this line.
local all all ident
and change it to…
local all all md5
Then restart the service.
The second step I usually do is to install the admin pack.
su - postgres psql template1 < /usr/share/postgresql/8.4/contrib/adminpack.sql psql -d template1 -c "ALTER USER postgres WITH PASSWORD 'newpassword';"
The next step is to create a new database and user to be used by your application. Assume the application is named ‘Social Dating’.
createdb socialdatingdb createuser socialdatinguser --pwprompt psql socialdatingdb GRANT ALL TO socialdatinguser
Then you can test CRUD on the database with…
psql -U socialdatinguser -W socialdatingdb
Please share this page to anyone who think it is helpful for them.