title: Access denied for user 'testuser'@'localhost' to database 'testdb'
body: <p>Trying to connect to a db with </p>
  
  <pre><code>$conn = new mysqli($servername, $username, $password, $dbname);
  if ($conn-&gt;connect_error) {
    die("Connection failed: " . $conn-&gt;connect_error);
  } else {
    echo '.';
  }
  </code></pre>
  
  <p>and I get </p>
  
  <pre><code>Connection failed: Access denied for user '*'@'localhost' to database '*'
  </code></pre>
  
  <p>but if I use</p>
  
  <pre><code>$conn = mysqli_connect($servername, $username, $password, $dbname);
  if ($conn-&gt;connect_error) {
    die("Connection failed: " . $conn-&gt;connect_error);
  } else {
    echo '.';
  }
  </code></pre>
  
  <p>it works! What gives?</p>
  
  <p>I've used new mysqli before in and it worked fine. I know my username/password are right. Its GoDaddy and I clicked all of the permissions. What is going on?</p>
  
  <p>Edit:</p>
  
  <p>Running this:</p>
  
  <pre><code>&lt;?php 
  ini_set('display_errors',1);
  error_reporting(E_ALL);
  
  $servername = "localhost";
  $username = "testuser";
  $password = "testpassword";
  $dbname = "testdb";
  
  mysqli_report(MYSQLI_REPORT_ERROR | MYSQLI_REPORT_STRICT);
  $conn1 = mysqli_connect($servername, $username, $password, $dbname);
  $conn2 = new mysqli($servername, $username, $password, $dbname);
  var_dump($conn1-&gt;stat, $conn2-&gt;stat);
  </code></pre>
  
  <p>Output:</p>
  
  <pre><code>Fatal error: Uncaught exception 'mysqli_sql_exception' with message 'Access denied for user 'testuser'@'localhost' to database 'testdb'' in /home/public_html/wj-test.php:11 
  Stack trace: 
      #0 /home/public_html/wj-test.php(11): mysqli_connect('localhost', 'testuser', 'testpassword', 'testdb') 
      #1 {main} thrown in /home/public_html/wj-test.php on line 11
  </code></pre>