当前位置:网站首页>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为网关就行看这篇博客。
边栏推荐
猜你喜欢

3D point cloud processing series - ---- PCA
![[unity] timeline learning notes (VII): Custom clip](/img/25/0402a28539cb568d5a539a757b2482.png)
[unity] timeline learning notes (VII): Custom clip
![[p5.js learning notes] local variable (let) and global variable (VaR) declaration](/img/37/82cdf73eb6527fb2da5bc550c33223.png)
[p5.js learning notes] local variable (let) and global variable (VaR) declaration

PS fast making full screen watermark

Openpcd安装过程记录

【Unity】Timeline学习笔记(七):自定义片段(Clip)

mmdetection3D---(1)

Jerry ac692x --- matrix keyboard addition

leetcode系统性刷题(二)------贪心、回溯、递归
![[unity] how to play sprite Jiugongge?](/img/cf/112a048c0bb335d058806dd5604d10.png)
[unity] how to play sprite Jiugongge?
随机推荐
Branch and loop (for and do while)
进程、线程、信号量和互斥锁
2022 idea (student email authentication) installation and use tutorial and basic configuration tutorial
禅道项目管理软件,敏捷开发团队不可或缺的工具
On the non recursive and recursive implementation of finding the nth Fibonacci number respectively
Jerry ac692n --- prompt tone compression and modification
abstract、static、final
leetcode系统性刷题(三)-------二叉树、二分查找
MySQL details
[unity] how to play sprite Jiugongge?
[阅读笔记] For Paper:R-CNN系列的三篇论文总结
mmdetection3d(2)---结果、log可视化
Branch and loop statements
PyTorch中grid_sample的使用方法
概率函数P(x)、概率分布函数F(x)与概率密度函数f(x)的区别
Mmdetection3d (2) -- visualization of results and logs
webview里面$(document).width()都是一个值
[advanced C language] - function pointer
Use of multithreading
leetcode系统性刷题(四)-----哈希表与字符串