gpt4 book ai didi

mysql - wordpress docker无法连接mysql docker

转载 作者:行者123 更新时间:2023-11-29 17:41:48 25 4
gpt4 key购买 nike

不知道我做错了什么,但我的 wordpress docker 无法连接到 mysql docker。有人可以帮我吗?

version: '2'
services:
db:
image: mysql:8.0
container_name: eve_db
volumes:
- ./database/data:/var/lib/mysql
- ./database/initdb.d:/docker-entrypoint-initdb.d
restart: always
environment:
MYSQL_ROOT_PASSWORD: skdjd # any random string will do
MYSQL_DATABASE: djdjd # the name of your mysql database
MYSQL_USER: djdjd # the name of the database user
MYSQL_PASSWORD: djdjd # the password of the mysql user
wordpress:
depends_on:
- db
image: wordpress:php7.2 # we're using the image with php7.1
container_name: eve_de
ports:
- "8080:80"
restart: always
links:
- db:mysql
volumes:
- ./src/wp:/var/www/html

我也定义了

define('DB_HOST', 'db:3306');

在 wp-config.php 文件中。但这没有用。

最佳答案

主站点有 mysql v5.6.38。在 docker-compose.yml 中更改相同内容解决了该问题。

关于mysql - wordpress docker无法连接mysql docker,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49964256/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com