I can not connect to the mysql database using php. "getaddrinfo failed"

Website URL


Error Message

When I execute the php script located at https://wbrk.rf.gd/res/api/account/checksession.php I get this error.

Connection failed: php_network_getaddresses: getaddrinfo failed: Name or service not known

Other Information

The exact code in this php script is as follows:


$conn = mysqli_connect("sql213.epizy.com ", "epiz_example", "*************", "epiz_example_dbname");
if (!$conn) {
  die("Connection failed: " . mysqli_connect_error());


I already tried searching for this error, but it seems that it has something to do with nameservers from the host?

Are you sure that sql213.epizy.com is the correct server for your account?
These domains aren’t regular domains, they either resolves to some local IP or was hardcoded into the hosts file on the server (I guess), so it must be correct.

Ding ding ding ding ding ding! The problem is in the space on the database hostname! Removing that should work.


I feel so stupid right now. That is such a huge mistake and how could I miss that.

We all make mistakes, now you know what to look for text time it stops working!


This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.