Amino
Amino

Reputation: 9

why the database connection symphony dont work?

i want just to host a website previously work , into another web server i have change parameters.yml file with new host parameteres of connection i have upload all my files , and i have import my databases when i try to enter (myhost/web ) i have this errors : Access denied for user 'root'@'localhost' (using password: NO)

error.log

[07-Dec-2022 15:30:13 Africa/Algiers] PHP Fatal error: Uncaught exception 'PDOException' with message 'SQLSTATE[28000] [1045] Access denied for user 'root'@'localhost' (using password: NO)' in /home2/icares/logicom.dz/ncomparer/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOConnection.php:43 Stack trace: #0 /home2/icares/logicom.dz/ncomparer/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOConnection.php(43): PDO->__construct('mysql:host=127....', 'root', NULL, Array) #1 /home2/icares/logicom.dz/ncomparer/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOMySql/Driver.php(45): Doctrine\DBAL\Driver\PDOConnection->__construct('mysql:host=127....', 'root', NULL, Array) #2 /home2/icares/logicom.dz/ncomparer/vendor/doctrine/dbal/lib/Doctrine/DBAL/Connection.php(360): Doctrine\DBAL\Driver\PDOMySql\Driver->connect(Array, 'root', NULL, Array) #3 /home2/icares/logicom.dz/ncomparer/vendor/doctrine/dbal/lib/Doctrine/DBAL/Connection.php(429): Doctrine\DBAL\Connection->connect() #4 /home2/icares/logicom.dz/ncomparer/vendor/doctrine/dbal/lib/Doctrine/DBAL/Connection.php(389): in /home2/icares/logicom.dz/ncomparer/app/cache/prod/classes.php on line 3390

I have change the parameters of connection with new server , but the error is that username root password no and server is localhost , what i must do ?

Upvotes: 0

Views: 476

Answers (1)

Ninki
Ninki

Reputation: 93

The error.log says that your Symfony trying to access database (probably MySQL) via the user 'root' from a local host. But your database, MySQL is not set to allow access as 'root'.

MySQL and most databases do not allow to access as 'root' as default as security reason, especially without password (what your erro said).

So, may be you need to check:

  • What is your database_user and database_password set in Symfony project (parameters.yml?)
  • Check MySQL from cli that what kind of previleges are set for your database.

The way to access mysql without password may find here: Allow linux root user mysql root access without password

Or some hints may be here: How to create a root user with no password in mysql

Upvotes: 0

Related Questions