我发现了许多关于我的问题的解决方案,但我仍然无法解决它。这可能是另一个问题,或者很可能是我没有设法理解出了什么问题。经过几周的测试,我确实试图公开寻求一些支持。
我正在尝试在我的个人服务器(Ubuntu 22.04)上设置WordPress。
下面是我的docker-compose文件:
version: '3'
services:
wp-db:
container_name: wp-mysql_container
image: mysql:latest
restart: unless-stopped
environment:
TZ: "Europe/Paris"
MYSQL_ROOT_PASSWORD: ZZZZ
MYSQL_USER: mywpuser
MYSQL_DATABASE: mywpdb
MYSQL_PASSWORD: XXXX
MYSQL_TCP_PORT: 3307
volumes:
- ./wp-db_data:/var/lib/mysql
ports:
- 3307:3307
wordpress:
container_name: wordpress_container
image: wordpress:latest
restart: always
depends_on:
- wp-db
ports:
- 8082:80
environment:
WORDPRESS_DB_HOST: wp_db:3307
WORDPRESS_DB_USER: mywpuser
WORDPRESS_DB_PASSWORD: XXXX
WORDPRESS_DB_NAME: mywpdb
volumes:
- ./wordpress:/var/www/html
- ./wordpress_logs:/var/log/apache2
wp-phpmyadmin:
container_name: wp-phpmyadmin_container
image: phpmyadmin:latest
depends_on:
- wp-db
links:
- wp-db:wp-db
ports:
- 8083:80
environment:
UPLOAD_LIMIT: 100000000
restart: unless-stopped
volumes:
wordpress:
wordpress_logs:
wp-db:
wp-db_data:
当我试图达到的phpmyadmin的WordPress,我得到错误消息“数据库错误:建立数据库连接时出错”
任何帮助将不胜感激,谢谢
我试着追踪这些相关的主题:
- Wordpress Docker "Error establishing a database connection"
- Docker Wordpress: Error establishing a database connection
- DOCKER and WordPress: Error establishing a database connection
在许多其他人中...
编辑:2023/10/09现在我的docker-compose是这样的,并且正在工作:
version: '3.8'
services:
wordpress:
container_name: wordpress_container
image: wordpress:latest
restart: always
ports:
- 8082:80
environment:
WORDPRESS_DB_HOST: wp_db_mysql
WORDPRESS_DB_USER: qqqqqqqqqqq
WORDPRESS_DB_PASSWORD: aaaaaaaaaaaaaa
WORDPRESS_DB_NAME: yyyyyyyyyyy
volumes:
- wp_data:/var/www/htmlqsdgjuytac
wp_db_mysql:
container_name: wp_mysql_container
image: mysql:5.7
restart: always
ports:
- 3307:3307
environment:
MYSQL_DATABASE: yyyyyyyyyyy
MYSQL_ROOT_PASSWORD: bbbbbbbbbb
MYSQL_USER: qqqqqqqqqqq
MYSQL_PASSWORD: aaaaaaaaaaaaaa
volumes:
- db_data:/var/lib/mysql
wp_phpmyadmin:
container_name: wp_phpmyadmin_container
image: phpmyadmin/phpmyadmin:latest
depends_on:
- wp_db_mysql
ports:
- 8083:80
restart: always
environment:
PMA_HOST: mysql
PMA_PORT: 3307
PMA_ARBITRARY: 1
volumes:
wp_data:
db_data:
但是,当我尝试更改MYSQL_PASSWORD时,将所有“aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa我再次收到错误消息。我试过:
- docker-compose up -d
- docker-compose down && docker image prune -af后跟docker-compose up -d。
显然我不能相信“aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
1条答案
按热度按时间t40tm48m1#
我也在这里,我的WP刚刚开始工作。下面是我的代码。
请注意,臭名昭著的消息 * 错误建立数据库连接 * 仍然可能发生:即使
docker
说“完成”,如果你立即转到浏览器,你会得到这个消息。在我的情况下,我必须等待~5秒钟,然后它接受连接(在此之前,消息出现)。此外,我注意到人们建议使用
mysql:5.7
,所以我建议您更改它(在我看来,Oracle企业系统中应用了其他版本(8))。