lundi 21 décembre 2015

Doctrine Console error SQLSTATE[08006] [7] FATAL: Ident authentication failed for user "SYSTEMUSER"

I created a composer project with PHP 5.6.16, laravel/framework 5.1 and doctrine/orm 2.5.

Installed Postgresql 9.4 and Postgres Admim 3.

Create a admin role, a test database with a test table. Granted all permissions on database and tables to admin role.

$host   = 'localhost';
$dbname = 'test';
$dbuser = 'admin';
$dbpass = 'secret';

$connection = new PDO("pgsql:dbname=$dbname;host=$host", $dbuser, $dbpass);
if ($connection) {
   $connection->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
   $collection = $connection->query('select * from test');
   foreach ($collection as $row) {
      var_dump($row);

All works fine.

I created a cli-config.php file that loads the database config file from laraval framework with the same setup, creates a EntityManager through a service provider and returns a console runner:

$provider      = new App\Providers\DoctrineServiceProvider($app);
$entityManager = $provider->getEntityManager();

return \Doctrine\ORM\Tools\Console\ConsoleRunner::createHelperSet($entityManager);

I'm sure the EntityManager was created and i'm sure the correct database configuration was used.

When I run "vendor/bin/doctrine orm:validate-schema", i got an excetion:

[Doctrine\DBAL\Exception\ConnectionException] An exception occured in driver: SQLSTATE[08006] [7] FATAL: Ident authentication failed for user "SYSTEMUSER"

[Doctrine\DBAL\Driver\PDOException] SQLSTATE[08006] [7] FATAL: Ident authentication failed for user "SYSTEMUSER"

[PDOException] SQLSTATE[08006] [7] FATAL: Ident authentication failed for user "SYSTEMUSER"

Not that the user on exception message is different from the role used. The SYSTEMUSER is equals to my Ubuntu user.

I changed the dbuser to postgres and i got the same exception.

Anyone have clues about this?



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire