I'm trying to connect to a MYSQL database using PHP. I have this to connect to the database:
<?php
$servername = "localhost";
$username = "orbital";
$password = "XXXXXXXX";
$dbname = "helios";
function establishConnection() {
// Create connection
$conn = new mysqli($servername, $username, $password, $dbname);
// Check connection
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
return $conn;
}?>
However, whenever I call establishConnection()
I get:
Connection failed: Access denied for user 'webmaster'@'localhost' (using password: NO)
webmaster is the user on my machine which runs Apache. Why is it using the webmaster user with no password instead of the specified 'orbital' user?