CodeIgniter database error when opening the website
<p>The website works fine for a while but in a few days returns this error :</p>

<blockquote>
  <p>A PHP Error was encountered</p>
  
  <p>Severity: Warning</p>
  
  <p>Message: mysqli::real_connect(): (HY000/2002): Can't connect to local
  MySQL server through socket '/var/lib/mysql/mysql.sock' (111)</p>
  
  <p>Filename: mysqli/mysqli_driver.php</p>
  
  <p>Line Number: 202</p>
  
  <p>Backtrace:</p>
  
  <p>File: /var/www/html/application/controllers/Login.php Line: 8
  Function: database</p>
  
  <p>File: /var/www/html/index.php Line: 289 Function: require_once</p>
  
  <p>A Database Error Occurred</p>
  
  <p>Unable to connect to your database server using the provided settings.</p>
  
  <p>Filename: core/CodeIgniter.php</p>
  
  <p>Line Number: 500</p>
</blockquote>

<p>Help will be appreciated </p>

<p>Thanks</p>

<p>Nipun</p>