[英]Symfony with DDEV CLI db connection
I want to start a Symfony Project using docker !我想使用 docker 开始一个 Symfony 项目! I tried to build it using DDEV CLI!我尝试使用 DDEV CLI 构建它! https://ddev.readthedocs.io/en/stable/users/cli-usage/ https://ddev.readthedocs.io/en/stable/users/cli-usage/
I used the standard configuration from DDEV.我使用了 DDEV 的标准配置。 (php) (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: .env 文件:
DATABASE_URL="mysql://db:db@db:3306/db?serverVersion=10.2"
When I change the host to: 127.0.0.1 in.env:当我将主机更改为: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 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.请在这方面寻求帮助。
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
). 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这是必需的,因为用于在一个容器和任何其他容器之间进行通信的主机名只能从容器本身内解析
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.