I hope this question falls within the scope of this site. I have created a Lightsail instance in AWS and added a MYSQL database to it. I have been able to connect to the database with Workbench, but not with a PHP file hosted in my instance.
I have checked the servername, username, password and dbname 20 times. Every time I try to connect I get the error message: "Connection failed 6: Unknown database 'Databasename-1'". Does anybody know of a guide on troubleshooting connecting to a MYSQL database on Lightsail?
<?php
$servername = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx.rds.amazonaws.com";
$username = "xxxxxx";
$password = "xxxxxx";
$dbname = "Databasename-1";
$conn = new mysqli($servername, $username, $password, $dbname);
if ($conn->connect_error) {
die("Connection failed 6: " . $conn->connect_error);
}