Search This Blog

Monday, October 15, 2012

Setting up Postgresql for the default OS user


I tried accessing Postgresql user from my default login on Ubuntu (this is not a sudoer level user) and was unable to do so.

> psql

Gave the following response


So, I needed to add the currently logged in Ubuntu user to the postgresql list of users. For that I switched to the postgres user by entering the following and the postgres user password in the response.

> su – postgres

That made postgres user the current user in my Ubuntu session.


Now, to add the database user for current user as follows:

> createuser --superuser arthgallo

Where arthgallo is my OS level user name




Now, we need to enter the password for this database level user. For that, lets login to the psql prompt using the postgres user.

At the psql prompt, enter the command to update the password for arthgallo user.

psql > \password arthgallo


Enter your OS level password twice

Now quit the psql prompt using '\q' and 'exit' from the postgres user by entering 'exit'. Thus should bring you back to the OS level prompt for your user (arthgallo) in my case.

Enter the command to create the default database

> createdb arthgallo


Now start the psql prompt, and you should be connecting to postgresql session with your default database.


That's it!!




No comments: