Unknown MySQL server host

前端 未结 5 1069
Happy的楠姐
Happy的楠姐 2021-02-04 04:08

When trying to connect to my database server, i encounter the problem of unknown host:

Warning: mysqli::mysqli() [mysqli.mysqli]: (HY000/2005):          


        
5条回答
  •  庸人自扰
    2021-02-04 04:38

    I know this is an old question. But I ran into this same issue today, and none of the answers I found were the right one.

    The issue in my case ended up being that port 3306 is not open on our firewall, and I was attempting to connect to an internal mysql database from an external server.

    I'm not sure why the error it gives you is "Unknown Host" in this case. I would have expected something more like "Unable to connect." or "Connection refused.", but using the exact same code from an internal server worked fine, leading me to this conclusion.

提交回复
热议问题