How to configure PostgreSQL in Ubuntu

Posted in:Tips 'n Tricks
  • To use postgresql, create a database instance and a user/role:
             sudo -u postgres createdb $USER
             sudo -u postgres createuser $USER
  • Making both database instance and user/role as your login ID lets you to start PostgreSQL client very easily:
                     psql 
  • To login as the administrator:
              sudo -u postgres psql
  • To be able to login from remote machine or from PHP or through JDBC driver, you have to set your password from PostgreSQL client (psql):
              ALTER USER user PASSWORD 'pass';
  • replace user and pass by your user name and password respectively. To test whether remote login works or not, run:
              psql -h host -p 5432 -d database -U user

Content Courtesy: http://www.ubuntuguide.org
Content License:http://www.gnu.org/copyleft/fdl.htm

Press the button below if you liked this site.
webmaster's picture

The brains or the lack of it behind Ubuntu Manual. Crazy about Linux, hates windows except for the fact that it runs many of his favorite games by default. Loves blogging

writeforus