Change the user to connect to postgresql #16151
Unanswered
edwin-agudelo
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hello.
I'm trying to use Phalcon just to connect to a database and select the info in a table and bring it as JSON. I configure the connection but is currently launching an error related with the authentication, but the user showed in the message is not the user that I configured in the script:
[ERROR] Error On Querying: PDOException: SQLSTATE[08006] [7] FATAL: password authentication failed for user "SYSTEM" in C:\php\app\config\di.php:49 Stack trace: #0 [internal function]: PDO->__construct('pgsql:host=192....', 'phpuser', 'phpuser', Array) #1 [internal function]: Phalcon\Db\Adapter\Pdo\AbstractPdo->connect(Array) #2 [internal function]: Phalcon\Db\Adapter\Pdo\Postgresql->connect(Array) #3 [internal function]: Phalcon\Db\Adapter\Pdo\AbstractPdo->__construct(Array) #4 [internal function]: Phalcon\Db\Adapter\Pdo\Postgresql->__construct(Array)
The code that I used to configure the application is:
return new \Phalcon\Config\Config( [ 'database' => [ 'adapter' => 'Postgresql', 'host' => '192.168.20.201', 'port' => 5432, 'username' => 'phpuser', 'password' => 'phpuser', 'dbname ' => 'solumekd', 'schema' => 'referencia', ], 'application' => [ 'controllersDir' => 'app/controllers/', 'modelsDir' => 'app/models/', 'baseUri' => '/', ], ] );
and the connection is made by:
$di->set( 'db', function() use( $config ) { return (new PdoFactory())->newInstance( 'postgresql', [ 'host' => $config->database->host, 'username' => $config->database->username, 'password' => $config->database->password, 'dbname' => $config->database->dbname, ] ); } );
As can see: the user is 'phpuser' but the error reported is from the user "SYSTEM". I'm was trying to fix in different ways, but I'm really lost.
My current environment is:
Please let me know if someone could help me.
Beta Was this translation helpful? Give feedback.
All reactions