title: mysqli, SQL error: Access denied for user 'user'@'localhost' (using password: YES)
body: <p>I'm moving from an hosting service to another one and I've a problem on the DB connection with the new hosting provider.</p>
  
  <p>Environment:</p>
  
  <ul>
  <li>PHP  5.4.43 </li>
  <li>MySQL 5.6.32</li>
  </ul>
  
  <blockquote>
  <pre><code>$sqlHost = "localhost";
  $sqlUser = "user";
  $sqlPassword = "pwd";
  $sqlDatabase = "databasename";
  
  $mysqli = new mysqli($sqlHost, $sqlUser, $sqlPassword, $sqlDatabase);
  if($mysqli-&gt;connect_errno){
    echo "SQL error: " . $mysqli-&gt;connect_error;
    exit;
  }
  </code></pre>
    
    <p>SQL error: Access denied for user 'user'@'localhost' (using password:
    YES)</p>
  </blockquote>
  
  <p>In the old hosting provider the only difference was the <em>MySQL version 5.5</em> and I never had a connection problem.</p>
  
  <p>If I change the connection code with:</p>
  
  <pre><code>$conn = mysql_connect(HOST,DB_USER,DB_PASSWORD) OR die("Unable to connect");
  mysql_select_db(DB,$conn);
  </code></pre>
  
  <p>I can correctly connect to the database with the user I created.
  What could be the problem?</p>