浏览器上无法访问wordpress,error establishing a database connection
来源:6-1 根据前面所学部署一个wordpress
慕虎4509735
2021-03-24
我按照之前有一个类似问题的帖子进行了尝试 https://coding.imooc.com/learn/questiondetail/217671.html ,nginx可以在80映射到8080端口在服务器打开,我进去到container里通过127.0.0.1:80也可以访问wordpress,mysql我已经改成了5.7版本的,但还是无法在浏览器打开wordpress
网上错误提示:
This either means that the username and password information in your wp-config.php file is incorrect or we can’t contact the database server at mysql:3306. This could mean your host’s database server is down.
Are you sure you have the correct username and password?
Are you sure you have typed the correct hostname?
Are you sure the database server is running?
2回答
-
qq_Luckydog_5
2021-04-20
version: '3'
services:
wordpress:
image: wordpress
ports:
- 8000:80
depends_on:
- mysql
links:
- mysql
environment:
WORDPRESS_DB_HOST: mysql:3306
WORDPRESS_DB_USER: root
WORDPRESS_DB_PASSWORD: root
WORDPRESS_DB_NAME: wordpress
networks:
- my-bridge
mysql:
image: mysql:5.6
environment:
MYSQL_ROOT_PASSWORD: root
MYSQL_DATABASE: wordpress
volumes:
- mysql-data:/var/lib/mysql
networks:
- my-bridge
volumes:
mysql-data:
networks:
my-bridge:
driver: bridge
wordpress配置不全 数据库连接地址 端口 用户 密码 库都得指定 要是用docker-compose的话 需要做一下links
112023-04-05 -
麦兜搞IT
2021-03-28
“nginx可以在80映射到8080端口在服务器打开”
“但还是无法在浏览器打开wordpress”
我没有太明白您的问题,服务器上打开?浏览器打开?您可以相信说一下么?另外如果您说的服务器是一个远程的服务器,请问防火墙或者是安全策略之类的有打开么?00
相似问题