Access denied for user ''@'localhost' (using password: NO) using AWS and EC2
<p>I am getting the following error when using SHIFTEDIT IDE to try connect to my amazon EC2 instance running LAMP server and mysql server. </p>

<p>The code I am writing in PHP to connect to my sql server is as followed:</p>

<pre><code>&lt;?php
function connect_to_database() {

$link = mysqli_connect("localhost", "root", "test", "Jet");

if (!$link) {
    echo "Error: Unable to connect to MySQL." . PHP_EOL;
    echo "Debugging errno: " . mysqli_connect_errno() . PHP_EOL;
    echo "Debugging error: " . mysqli_connect_error() . PHP_EOL;
    exit;
}

echo "Success: A proper connection to MySQL was made! The my_db database is great." . PHP_EOL;
echo "Host information: " . mysqli_get_host_info($link) . PHP_EOL;

mysqli_close($link);

}
?&gt;
</code></pre>

<blockquote>
  <p>OUTPUT: Success: A proper connection to MySQL was made! The my_db database is
  great. Host information: Localhost via UNIX socket Access denied for
  user ''@'localhost' (using password: NO)</p>
</blockquote>

<p>I am definitely using the right password for root as I can successfully login when using Phpmyadmin, I just cannot make a connection with PHP for some reason.</p>

<p>Currently, I have a single Amazon ec2 instance with LAMP server and a MySQL server installed.  Any help will be much appreciated.</p>

<p>EDIT: I am using Php 5.6.17</p>