Jump to content

Database Problem


Recommended Posts

<?php
$servername = "localhost";
$username = "user";
$password = "pass";
$dbname = "db_name";
$conn = new mysqli($servername, $username, $password, $dbname);
// Check connection
if ($conn->connect_error) {
   echo "connection problem";
   //die("Connection failed: " . $conn->connect_error);
}

 

This is the code of this page on my website. Until last week everything seemed to be working fine. But recently I'm getting an error message,

Warning: mysqli::mysqli(): (HY000/2002): No such file or directory in /home/soumik/public_html/dbconnect.php

 

What happened suddenly to cause this error? The user exists for the respective database, and all was fine till last week, and I haven't made any changes in my code either.

 

The problem got away on replacing localhost with 127.0.0.1 <_<

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
×
×
  • Create New...