4

docker 里 修改 mysql 8 对外端口

 2 years ago
source link: https://xmetal.cc/?p=2064
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

mysql8 docker 容器修改端口 需要到容器里 /etc/mysql/my.cnf 修改或添加端口号, 建议从容器里复制出来修改

1 先复制到host

sudo docker cp wordpress_db_1:/etc/mysql/my.cnf ./  #从容器复制到host

2 编辑 my.cnf 修改或添加端口号 如port:3307

3 放回容器

sudo docker cp ./my.cnf wordpress_db_1:/etc/mysql/ #放回容器

4 然后重启 docker restart 容器名

修改后的端口和暴露的端口一致就可以连接成功, 如 – port 3307:3307

Post navigation

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Comment *

Name *

Email *

Website


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK