title: Fatal error: Uncaught exception 'mysqli_sql_exception' with message 'Permission denied'
body: <p>On my webpage I'm using PHP and I run it in Ubuntu 16.04.</p>
  <p>It works well.</p>
  <p>Then I try to run it on CentOS 5.11 (I know centOS 5.11 is out of date, but for many reasons I must I use it).</p>
  <p>And the result is my webpage doesn't work.</p>
  <p>I show this error:</p>
  <blockquote>
  <p>Fatal error: Uncaught exception 'mysqli_sql_exception' with message 'Permission denied' in /var/www/html/IPU-GUI/website2/templates/sql_login.php:3 Stack trace: #0 /var/www/html/IPU-GUI/website2/templates/sql_login.php(3): mysqli_connect('127.0.0.1', 'root', '123456', 'ipu1') #1 /var/www/html/IPU-GUI/website2/sip.php(30): require_once('/var/www/html/I...') #2 {main} thrown in /var/www/html/IPU-GUI/website2/templates/sql_login.php on line 3</p>
  </blockquote>
  <p>Here is my code:</p>
  <pre><code>&lt;?php
  require '../functions/server_info.php';
  $conn = mysqli_connect($sql_login[&quot;host&quot;], $sql_login[&quot;username&quot;], $sql_login[&quot;password&quot;], $sql_db);
  if (!$conn) {
      echo mysqli_connect_error();
  }
  ?&gt;
  </code></pre>
  <p>And server_info.php</p>
  <pre><code>$sql_login = array(
  &quot;host&quot;=&gt;&quot;127.0.0.1&quot;, 
  &quot;port&quot;=&gt;&quot;3306&quot;, 
  &quot;username&quot;=&gt;&quot;root&quot;,
  &quot;password&quot;=&gt;&quot;123456&quot; 
  );
  $sql_db = &quot;ipu1&quot;; 
  </code></pre>
  <p>UPDATE: I try to fix this error by change &quot;host&quot;=&gt;&quot;127.0.0.1&quot; to &quot;host&quot;=&gt;&quot;localhost&quot; it works.
  But I don't know what wrong? What different from &quot;127.0.0.1&quot; and &quot;localhost&quot;.</p>