If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > PostgreSQL > How do I disable password checking for accessing database from commandline

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 04-30-11, 01:18
shilpa24 shilpa24 is offline
Registered User
 
Join Date: Apr 2011
Posts: 14
How do I disable password checking for accessing database from commandline

hi ,
i want to access postgre database by passing command in command line but without password checking ,i m using this command
"psql.exe -d postgres -p 5432 -U postgres"
but with this command it prompted to enter password
is ther any option to pass password with this command ,i tried -w password option with this but extra argument ignored error appears,i want to access postgres database without user interaction
any help its urgent
Reply With Quote
  #2 (permalink)  
Old 04-30-11, 03:15
shammat shammat is offline
Registered User
 
Join Date: Nov 2003
Posts: 2,408
Three possibilities:

1) use trust authentication for localhost as described here in the manual: http://www.postgresql.org/docs/curre...tml#AUTH-TRUST

2) use an environment variable as described here in the manual: http://www.postgresql.org/docs/curre...pq-envars.html

3) use a password file as described here in the manual: http://www.postgresql.org/docs/curre...pq-pgpass.html
Reply With Quote
  #3 (permalink)  
Old 05-02-11, 06:35
shilpa24 shilpa24 is offline
Registered User
 
Join Date: Apr 2011
Posts: 14
how to edit pg_hba.conf file from command line

Hello shammat,
Thanks for your reply
you had written about trust authentication , but how do I set trust authentication without user interaction
C:\Program Files\Postgresql\8.4\bin>pgadmin3/ch:"C:/program files/postgresql/8.4/data/pg_hba.conf
I tried this command, but with this a window gets open and ther is option to change methos md5 to trust, is ther any parameters to pass with this command to edit “pg_hba.conf” file silently without user interaction

Reply With Quote
  #4 (permalink)  
Old 05-02-11, 06:54
shammat shammat is offline
Registered User
 
Join Date: Nov 2003
Posts: 2,408
You have a fundamentally misunderstanding of the pg_hba.conf
That is a global configuration file for your Postgres installation. You only change that once, after that no passwords are required.

If you want to do that each time you invoke psql, you should rather use the environment variable or the password file.
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On