Home » Php » php – SQLSTATE[HY000] [2002] php_network_getaddresses: getaddrinfo failed: nodename nor servname provided, or not known when run doctrine update command

php – SQLSTATE[HY000] [2002] php_network_getaddresses: getaddrinfo failed: nodename nor servname provided, or not known when run doctrine update command

Posted by: admin February 25, 2020 Leave a comment

Questions:

I run the project on the docker and creating db. Also I am going to migration the DB with Doctrine update console. But I got some issues.

 In AbstractMySQLDriver.php line 93:

  An exception occurred in driver: SQLSTATE[HY000] [2002] php_network_getaddresses: getaddrinfo failed: nodename no
  r servname provided, or not known


In PDOConnection.php line 31:

  SQLSTATE[HY000] [2002] php_network_getaddresses: getaddrinfo failed: nodename nor servname provided, or not known


In PDOConnection.php line 27:

  SQLSTATE[HY000] [2002] php_network_getaddresses: getaddrinfo failed: nodename nor servname provided, or not known


In PDOConnection.php line 27:

  PDO::__construct(): php_network_getaddresses: getaddrinfo failed: nodename nor servname provided, or not known

Also I config the db url on .env file like this:

DATABASE_URL=mysql://root:[email protected]:3306/{dbname}

How can I fix this? Please help me if you have experience in this issue,
Thank you

How to&Answers: