Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

IMPORTANT! Check the KNOWLEDGE BASE before posting! @

Unable to connect to MySQL Database


When I'm trying to connect from to db, I got that error: "Unable to connect: No such file or directory "
That's my php code:

$connection = new mysqli($server_name,$username,$pass,'epiz_21828165_nexus');
die("Connect error : " . $connection->connect_error);

host, user, pass and db is from "MySql Databases" located in cpanel.
How to resolve that issue?


  • That error message is listed in the Common MySQL Errors article. Please check that article first to see whether it answers your question.

  • The $server_name contain the same address that's shown in the Cpanel

  • edited March 24

    @ama123 said:
    The $server_name contain the same address that's shown in the Cpanel

    Well, apparently not, or you wouldn't get that error.

    I took a quick look at your code and I see two functions where you use mysql. The first one is configured properly, the second one tries to login as user root on server localhost without any password. The first one should work, the second one won't.

This discussion has been closed.