当我从Postgres创建用户时,我可以使用pg_connect
连接php,但是当我从php页面创建用户时
<?php
$host = "host=localhost";
$dbname = "dbname=cloud-personnel";
$user = "user=postgres ";
$pass = "password=root";
$port = "port=5432";
$db=pg_connect( "$host $port $dbname $user $pass" );
$alias = $_POST["alias"] ;
$categorie = $_POST["cat"] ;
$pass = $_POST["password"] ;
$sql = "UPDATE utilisateur SET nom_groupe = '$categorie', type_user='' WHERE alias='$alias'";
$sql2 = "create user $alias with password '$pass';";
$sql3 = "alter group $categorie add user $alias";
$result = pg_query($sql);
pg_query($sql2);
pg_query($sql3);
header("location: ajoutuser.php");
?>
在postgres上创建用户作为角色,就像我可以添加创建用户一样但当我尝试与pg_connect连接时,我有此错误消息“警告:pg_connect()[function.pg-connect]:无法连接到PostgreSQL服务器:致命:authentification par mot depasseéchouéepourl'utilisateur“
任何解决方案?
谢谢