-1

I want to start a Symfony Project using docker ! I tried to build it using DDEV CLI! https://ddev.readthedocs.io/en/stable/users/cli-usage/

I used the standard configuration from DDEV. (php)

As soon as I want to make:

php bin/console make:migration

I got :

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

.env file:

 DATABASE_URL="mysql://db:db@db:3306/db?serverVersion=10.2"

When I change the host to : 127.0.0.1 in .env:

 DATABASE_URL="mysql://db:db@127.0.0.1:3306/db?serverVersion=10.2"

I got:

   An exception occurred in driver: SQLSTATE[HY000] [2054] The server requested 
   authentication method unknown to the client  

DDEV config.yaml

  name: bib
  type: php
  docroot: public
  php_version: "7.3"
  webserver_type: nginx-fpm
  router_http_port: "80"
  router_https_port: "443"
  xdebug_enabled: false
  additional_hostnames: []
  additional_fqdns: []
  provider: default
  use_dns_when_possible: true

Kindly ask for help in this Regards.

Taher Ben sassi
  • 120
  • 2
  • 14
  • 2
    Please share more details - how **exactly** do you call `php bin/console`? From **within** the ddev container? – Nico Haase Mar 23 '21 at 14:04
  • 1
    @NicoHaase I missed that ! If I run **php bin/console** inside (DDEV ssh) works fine! I think this answer my question ! Everything is working fine using db as host! Thank you ! – Taher Ben sassi Mar 23 '21 at 14:11

1 Answers1

4

You need to run all such commands from within the ddev container, either through a SSH terminal (ddev ssh opens a shell in the container), or as an ad-hoc command (ddev exec php bin/console make:migration).

This is needed because the hostnames used to communicate between one container and any other are only resolve from within the containers itself

Nico Haase
  • 11,420
  • 35
  • 43
  • 69