I am getting the following error when using SHIFTEDIT IDE to try connect to my amazon EC2 instance running LAMP server and mysql server.
The code I am writing in PHP to connect to my sql server is as followed:
<?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);
}
?>
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)
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.
Currently, I have a single Amazon ec2 instance with LAMP server and a MySQL server installed. Any help will be much appreciated.
EDIT: I am using Php 5.6.17