GithubHelp home page GithubHelp logo

增加用户报错 about code6 HOT 5 CLOSED

4x99 avatar 4x99 commented on June 11, 2024
增加用户报错

from code6.

Comments (5)

yoonper avatar yoonper commented on June 11, 2024

MySQL 是装在宿主机吗?
MYSQL_HOST = 127.0.0.1 连不上宿主机 MySQL,你在宿主机执行 ifconfig 看看 docker0 的 IP,有可能是 172.17.0.1,在 Docker 容器里 telnet 这个 IP,能通了删掉容器重新启动一个

from code6.

cpkkcb avatar cpkkcb commented on June 11, 2024

宿主机安装的mysql,docker0 ip:172.18.0.1
docker run -d -p 8088:80 -e MYSQL_HOST=172.18.0.1 -e MYSQL_PORT=3306 -e MYSQL_DATABASE=code6

能ping通
PING 172.18.0.1 (172.18.0.1) 56(84) bytes of data.
64 bytes from 172.18.0.1: icmp_seq=1 ttl=64 time=0.072 ms
64 bytes from 172.18.0.1: icmp_seq=2 ttl=64 time=0.065 ms
但是依然报同样的错误

from code6.

yoonper avatar yoonper commented on June 11, 2024

telnet 172.18.0.1 3306 能通吗
通常连不上都是 iptable 防火墙 和 MySQL 未授权 这几个问题

from code6.

yoonper avatar yoonper commented on June 11, 2024

还有一个可能的原因
MySQL 配置文件绑定了 127.0.0.1,注释掉这行(如果有的话):

bind-address = 127.0.0.1

from code6.

cpkkcb avatar cpkkcb commented on June 11, 2024

👌

from code6.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.