How do you install Typecho in Docker and mount hosting server's Mysql service

本文详细介绍如何在已安装Docker和Portainer的环境下,通过CLI命令搜索并拉取Typecho镜像,创建容器并进行端口映射。同时,指导读者定位MySQL配置文件my.cnf,编辑该文件以实现更广泛的网络访问。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

Fist of all, I presume that you have already installed Docker and Portainer and works smoothly. All CLI procdures are based on BT Linux Platform with Mysqld.service ready, you could baidu with Bao Ta Mian Ban and implege it. and systemctl status mysqld will show the detail information whether Mysql actived or inactive.

Docker search and pull the Typecho image which your prefered. Creat a container, port mapping. and then ifconfig to findout the host server ip address with name Docker 0.

I hope you hold the location about Mysql config file with name "my.cnf", if you donnot, could type the CLI to find it.

locate my.cnf


/etc/my.cnf
/etc/my.cnf.d
/etc/my.cnf.d/mysql-clients.cnf
/var/lib/docker/overlay2/29512eeba9cc91ff3d4ea4fc8e5d6ee00e87dcbf225a5f31c3a6c55bdb603877/diff/etc/alternatives/my.cnf
/var/lib/docker/overlay2/29512eeba9cc91ff3d4ea4fc8e5d6ee00e87dcbf225a5f31c3a6c55bdb603877/diff/etc/mysql/my.cnf
/var/lib/docker/overlay2/29512eeba9cc91ff3d4ea4fc8e5d6ee00e87dcbf225a5f31c3a6c55bdb603877/diff/etc/mysql/my.cnf.fallback
/var/lib/docker/overlay2/29512eeba9cc91ff3d4ea4fc8e5d6ee00e87dcbf225a5f31c3a6c55bdb603877/diff/var/lib/dpkg/alternatives/my.cnf
/var/lib/docker/overlay2/36a4bb2bec11ae14f61398e5cf883bf7f23dbce03babb47f1dc3669663d98798/diff/etc/alternatives/my.cnf
/var/lib/docker/overlay2/36a4bb2bec11ae14f61398e5cf883bf7f23dbce03babb47f1dc3669663d98798/diff/etc/mysql/my.cnf
/var/lib/docker/overlay2/36a4bb2bec11ae14f61398e5cf883bf7f23dbce03babb47f1dc3669663d98798/diff/etc/mysql/my.cnf.fallback
/var/lib/docker/overlay2/36a4bb2bec11ae14f61398e5cf883bf7f23dbce03babb47f1dc3669663d98798/diff/var/lib/dpkg/alternatives/my.cnf
/var/lib/docker/volumes/90ced81dcaa7bfb7b18b6d64f00a0e68ab9d81e640345c5969a780f1a88b4ee1/_data/my.cnf
/var/lib/docker/volumes/90ced81dcaa7bfb7b18b6d64f00a0e68ab9d81e640345c5969a780f1a88b4ee1/_data/my.cnf.fallback
/www/server/mysql/mysql-test/include/default_my.cnf
/www/server/mysql/mysql-test/suite/federated/my.cnf
/www/server/mysql/mysql-test/suite/rpl/my.cnf
/www/server/mysql/support-files/bt-my.cnf

Oh, so many "my.cnf" files was shown on screen, which one is we really need? follow the command 

ps aux|grep mysql|grep 'my.cnf'

maybe the CLI shown the blank. why? Because we donnot appiont the paticular "my.cnf" as the default.

we will ask mysql to answer our questions

mysql --help|grep 'my.cnf'


order of preference, my.cnf, $MYSQL_TCP_PORT,
/etc/mysql/my.cnf /etc/my.cnf ~/.my.cnf

finally, the true file loaded while program startup are shown out as order.

edit the /etc/mysql/my.cnf with nano 

Oh,NO~~~~, no word in the file.  OK, next file

add the sentence as below:

bind-address = 0.0.0.0

systemctl restart mysqld

 

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值