Question:I have installed Postgresql.x server under Red Hat Enterprise Linux 5. I have created username/password and database. But when I try to connect it via PHP or psql use the following syntax:
psql -d myDb -U username -W
It gives me an error that reads as follows:psql:Fatal: Ident authentication failed for user “username”.
How do I fix this error?A. To fix this error, open the PostgreSQL client authentication configuration file /var/lib/pgsql/data/pg_hba.conf:
# vi /var/lib/pgsql/data/pg_hba.conf:
# vi /var/lib/pgsql/data/pg_hba.conf:
# vi /var/lib/pgsql/data/pg_hba.conf:
# vi /var/lib/pgsql/data/pg_hba.conf.
Which hosts are allowed to connect, which clients are authenticated, which PostgreSQL usernames are available to which users, and which databases are accessible
By default, Postgresql uses identity-based authentication. All you have to do is allow authentication to your network or web server based on username and password.IDENT will never allow you to log in via the -U and -W options. Add the following to allow logins through local hosts only:
local all all trust host all 127.0.0.1/32 trustSave and close the file. Restart the Postgresql server:
# service Postgresql Restart
Now you should be able to log in using the following command:
$ psql -d myDb -U username -W
Read More:
- pg_ctl: no database directory specified and environment variable PGDATA unset , centos 7 postgreSQL
- PHP connection PostgreSQL error call to undefined function PG_ connect()
- SQL Server Error:233 and Error 18452
- Modify samba configuration, restart service failed
- SFTP login error: fatal error: received unexpected end of file from SFTP server
- A case diagnosis and solution of DB2 error code 1639 and SQL state 08001 is described in detail
- Error in Python connection to mongodb pymongo.errors.OperationFailure : Authentication failed.
- mac Upgrade: httpd: apr_sockaddr_info_get() failed for bogon
- Export and import method of MySQL under Linux
- 530 user cannot log in. Problem connecting to FTP server
- Python module learning-Paramiko-Use python to throw an exception: Authentication failed.
- Inexplicable exception 007: git error: authentication failed for
- [PostgreSQL tutorial] · PostgreSQL error prompt: “error 42501” or “permission denied”
- Pyspark36830;- 25509;- Postgresql38169; java.lang.ClassNotFoundException: org.postgresql.Driver
- Sendmail config error: mail loops back to me (MX problem?) solution
- When configuring ROS distributed / Error report solution and command requirements encountered in the process of master-slave computer
- MySQL error — multiple methods of failed to find valid data directory and MySQL setting password appear
- How to solve the SNMP error of cacti
- ansible Q&A: Failed to connect to the host via ssh: ssh_exchange_identification and Authentication or per
- Spring boot integrates Mongo to solve some common connection and permission problems. Docker compose installs Mongo