当前位置:网站首页>centos8按照docker官网创wordpress+mysql报错解决
centos8按照docker官网创wordpress+mysql报错解决
2022-07-28 16:38:00 【Ripo_za】
本片文章最要看最后
操作系统是centos8,最好还是别用这个了。
然后按照官网安装wordpress教程做,完全一样,安装完成之后访问网站提示。
Error establishing a database connection。
在网上找了一大堆解决方案也不行,以前都是用docker-compose up -d启动的,这样看不见错误,用docker-compose up启动后,可以看见错误提示
遇到同样问题的小伙伴可以参考这个网址,里面好多人给了意见。
1、首先确定centos的端口是否开启了,参考这个
2、
我是通过更改wordpress容器下wp-config.php文件成功的。
参考的是下面的截图的意见,但是直接更改wp-config文件,重启容器后还会变成和docker-compose文件一样的,下图中作者也说这不是好的解决方法,最好还是更改docker-compose文件吧。具体再看原文把。
图中网关地址的获取可以通过下面的命令得到。
这里使用网关地址,不用ip地址。
改完wp-config.php之后不用重启容易或者docker服务,直接会生效。重启docker就变回去了。
后记:
经过了解,我感觉应该是我电脑的问题,官网的docker-compose文件肯定是没问题的,我现在用官网的也可以了,但是还不确定当初导致的这个错误的原因究竟是什么。可能其中的某些尝试导致现在的可以正常运行了吧。
如果出现这个错误,先把firewall停掉,然后再重启docker服务,或者更改挂载目录,重新创建docker-compose up -d一下,没准也可能是之前配置的问题。
1、sudo systemctl disable firewalld
2、systemctl restart docker
关于为什么改db为网关就行看这篇博客。
边栏推荐
猜你喜欢
![[advanced C language] - analyze the storage of micro data in memory [2] (floating point storage)](/img/ae/0c5efd7d0179e77a25d6dbd4117c98.png)
[advanced C language] - analyze the storage of micro data in memory [2] (floating point storage)

es6 Promise

xcode打包ipa配置手动配置证书

Tips--解决No module named matlab.engine的问题
![[C language note sharing] custom type: structure, enumeration, Union (recommended Collection)](/img/25/4a17c260b2b506ae1224520d9b85d1.png)
[C language note sharing] custom type: structure, enumeration, Union (recommended Collection)

【机器学习笔记】Regularization : Ridge Regression(岭回归)

Methods, functions

2.2- data type
![[advanced C language] - Advanced pointer [i]](/img/62/d3410a61b931177fc02c1801489b5a.png)
[advanced C language] - Advanced pointer [i]

概率函数P(x)、概率分布函数F(x)与概率密度函数f(x)的区别
随机推荐
Grid in pytorch_ How to use sample
编译原理学习笔记1(编译原理概述与词法分析)
Multithreading (ThreadPoolExecutor of thread pool)
[C language note sharing] character function and string function (recommended Collection)
【Unity Scriptable Object】教程 | 在Unity中使用 Scriptable Object 存储物体数据信息
【Unity Tilemap】教程 | Basic、Rule Tile、Prefab Brush、Tilemap Collider
[p5.js learning notes] local variable (let) and global variable (VaR) declaration
ROS scattered knowledge points and error resolution
MySQL installation
【机器学习笔记】Regularization : Ridge Regression(岭回归)
Ros自定义消息及使用
From 0 to 1: Development notes of voting applet based on cloud development
电工学自学笔记1.22
Generation and use of dynamic link library (error summary)
数字滤波器(六)--设计FIR滤波器
abstract、static、final
[unity FPS] tutorial | using unity to make a first person character controller
The solution to the problem that the computer cannot be charged
电工学数电部分自学笔记1.25
On the non recursive and recursive implementation of finding the nth Fibonacci number respectively