We have just installed the PostgreSQL component into plesk but we cannot authenticate using the PHP function @pg_connect()
$connection = @pg_connect("host=localhost port=5432 dbname=my_db_name user=my_user password=my_pwd");
output("Connection: ".$connection);
The error is showed in the connection object that is printed:
Connection:
Array
(
[type] => 2
[message] => pg_connect(): Unable to connect to PostgreSQL server: FATAL: Ident authentication failed for user "my_user"
[file] => path/to/my/script.php
[line] => 5
)
Does anyone tried to use PostgreSQL DB on plesk? Did you use some ‘default’ username and password ?
2
Answers
Finally we found out that, in Linux, the default installation of PostgreSQL doesn't accept access through network socket connection but only through Unix socket.
So I can connect to DB using the default Unix socket, and the correct @pg_connect instruction is:
Looks like password for PostgreSQL user “postgres” does not correspond password in psa database.
Try to reset password for PostgreSQL admin user with command:
plesk bin database-server –update-server localhost:5432 -type postgresql -passwd 12345