3

I am trying to run

 php bin/console make:migration

I received these errors

In AbstractMySQLDriver.php line 93:
   An exception occurred in driver: SQLSTATE[HY000] [2002] php_network_getaddresses: getaddrinfo failed: Temporary failure in name resolution
 In PDOConnection.php line 31:
    SQLSTATE[HY000] [2002] php_network_getaddresses: getaddrinfo failed: Temporary failure in name resolution
 In PDOConnection.php line 27:
    SQLSTATE[HY000] [2002] php_network_getaddresses: getaddrinfo failed: Temporary failure in name resolution
 In PDOConnection.php line 27:
    PDO::__construct(): php_network_getaddresses: getaddrinfo failed: Temporary failure in name resolution

I have checked all of my .env files. I have configured the

DATABASE_URL=mysql://mylocalDb:#fL3@&_{Dx3N@127.0.0.1:3306/LocalDataBase

I have changed the doctrine config to use server_version: '5.7'. I don't know for sure if that correct. I just removed the # from in front of the line because of the note that said you must configure your server version. But not sure which server it is referring to.

So, my question is how do I test the database connection in Symfony. I have searched the documents and was unable to find a clear answer to this question. When I run

 php bin/console doctrine:database:create

This produces an error

 In CreateDatabaseDoctrineCommand.php line 82:
   Connection does not contain a 'path' or 'dbname' parameter and cannot be created.

I have cleared my cache twice after making config changes and still receive the same error messages. What other ways can I test the db connection.

https://symfony.com/doc/current/doctrine.html#configuring-the-database

user1794918
  • 1,131
  • 2
  • 16
  • 34

2 Answers2

5

Your DB password contains '@' which breaks Symfony's parser, changing the password to not have the symbol should resolve your issue.

ikyuchukov
  • 565
  • 3
  • 12
3

Like ikyuchukov said, the "@" character breaks the parsing. But instead of changing your password, url-encoding this character will do a better job, in my opinion. You can replace it with it's url-encoded value "%40".

Moonchild
  • 1,382
  • 10
  • 15