无法在 plesk 上的 PostgreSQL DB 中进行身份验证
Cannot authenticate in PostgreSQL DB on plesk
我们刚刚将 PostgreSQL 组件安装到 plesk 但我们无法使用 PHP 函数进行身份验证 @pg_connect()
$connection = @pg_connect("host=localhost port=5432 dbname=my_db_name user=my_user password=my_pwd");
output("Connection: ".$connection);
错误显示在打印的连接对象中:
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
)
有人试过在 plesk 上使用 PostgreSQL DB 吗?您是否使用了一些 'default' 用户名和密码?
看起来 PostgreSQL 用户 "postgres" 的密码与 psa 数据库中的密码不对应。
尝试使用以下命令重置 PostgreSQL 管理员用户的密码:
plesk bin 数据库服务器 --update-server localhost:5432 -type postgresql -passwd 12345
最后我们发现,在Linux中,PostgreSQL的默认安装不接受通过网络套接字连接访问,只能通过Unix套接字访问。
所以我可以使用默认的 Unix 套接字连接到数据库,正确的 @pg_connect 指令是:
$connection = @pg_connect("host='' port='' dbname=my_db_name user=my_user password=my_pwd");
我们刚刚将 PostgreSQL 组件安装到 plesk 但我们无法使用 PHP 函数进行身份验证 @pg_connect()
$connection = @pg_connect("host=localhost port=5432 dbname=my_db_name user=my_user password=my_pwd");
output("Connection: ".$connection);
错误显示在打印的连接对象中:
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
)
有人试过在 plesk 上使用 PostgreSQL DB 吗?您是否使用了一些 'default' 用户名和密码?
看起来 PostgreSQL 用户 "postgres" 的密码与 psa 数据库中的密码不对应。
尝试使用以下命令重置 PostgreSQL 管理员用户的密码:
plesk bin 数据库服务器 --update-server localhost:5432 -type postgresql -passwd 12345
最后我们发现,在Linux中,PostgreSQL的默认安装不接受通过网络套接字连接访问,只能通过Unix套接字访问。
所以我可以使用默认的 Unix 套接字连接到数据库,正确的 @pg_connect 指令是:
$connection = @pg_connect("host='' port='' dbname=my_db_name user=my_user password=my_pwd");