0 like 0 dislike
144 views

Please log in or register to answer this question.

1 Answer

0 like 0 dislike
answered by (13.4k points)  

Following simple Two steps you can connect the postgresql database automatically without any password prompt

Step 1. create the bash_profile:

[root@2ndquadrant.in]# cat .bash_profile
export PGPASSWORD="tcs@12345"
export PGHOST="10.0.1.109"
export PGUSER="enterprisedb"
export PGPORT="5444"
/opt/edb/as9.6/bin/psql -d edb

Step 2. Run the bash_profile by using sh or . you will see the following postgres sql prompt

[root@2ndquadrant.in]# sh .bash_profile
psql.bin (9.6.2.7)
Type "help" for help.

edb=# \dt
            List of relations
 Schema |  Name   | Type  |    Owner
--------+---------+-------+--------------
 public | dept    | table | enterprisedb
 public | emp     | table | enterprisedb
 public | jobhist | table | enterprisedb
 public | test    | table | enterprisedb
(4 rows)

 

Related questions

0 like 0 dislike
1 answer
0 like 0 dislike
1 answer
Welcome to PostgreSQL Database Discussion Forum where you can ask questions and receive answers from other members of the community. Can discuss here Oracle, Postgresql, mariadb , mySQL , AWS , Linux , MSSQL , MongoDB , Greenplum databases related queries ...etc.
...