title: Mysql error : mysqli_connect(): (HY000/2002): Connection refused
body: <p>I have install mysql on digital ocean and trying to connect through php script and I got this error </p>
  
  <blockquote>
    <p>mysqli_connect(): (HY000/2002): Connection refused in
    /var/www/waev.in/signup/ajax/send_code.php on line 9 Failed to connect
    to MySQL: Connection refused</p>
  </blockquote>
  
  <p>What can be the issue :</p>
  
  <p><strong>my php script</strong></p>
  
  <pre><code>&lt;?php
      include '../func/sms_function.php';
  
      $mysql_host='{ip}';
      $mysql_user='root';
      $mysql_pass='********';
      $my_db='wesearch_waev_user';
  
      $con = mysqli_connect($mysql_host,$mysql_user,$mysql_pass);
  
      if (mysqli_connect_errno())
      {
          echo "Failed to connect to MySQL: " . mysqli_connect_error();
      }
  ?&gt;
  </code></pre>