To change the authentication method:
-
Open a terminal window
-
Change into the postgres bin directory
Example: cd /usr/local/pgsql/bin
Note: Depending on your install environment the path to the bin directory may vary.
-
Type su – postgres and press Enter. This will change the logged in to the postgres user.
-
From the bin directory type ./psql
-
Type ALTER USER postgres password 'your shell account postgres password'; and press Enter. ALTER ROLE should be displayed.
-
Type \q and press Enter
-
Type vi /path to data directory/pg_hba.conf and press Enter
-
Modify the line at the bottom of the config file to resemble one of these examples.
Note: You will probably only have to change the word trust to md5. The line or lines should already exist.
host all postgres your.ip your.subnet md5
host all all your.ip your.subnet md5
Note: If you are using vi as the editor press i to insert text
-
Save the changes
Note: If you are using vi as the editor press i to insert then press :wq! to save the changes.
- From the postgres bin directory type./pg_ctl restart -D /usr/local/pgsql/data and press Enter