When logging into mysql in my terminal, everything works expected. But when I run my webpage with
$conn = new mysqli("localhost", "root", "password");
if($conn->connect_error) {
die("connection failed: " . $conn->connect_error);
}
echo "connected successfully";
I get "connection failed: Access denied for user 'root'@'localhost' (using password: YES)". I have tried resetting the root password. I have tried granting all permissions to root. I am absolutely positive that I am entering my username and password correctly in the php file.
I'm running a LAMP server on an Ubuntu 14.04 machine. I have php 5.5.9, mysql 5.5.40, and apache 2.4.7.
Can anyone help?
$conn = new mysqli("localhost", "root", "password","DB_NAME");