I was trying to make a simple database to write and read from and on pretty much one of the first steps I encountered a problem: it would not connect. I got the error message: "No connection could be made because the target machine actively refused it.". I looked at other stack overflow questions and they all had complex solutions involving changing the code of some things. I tried some, and nothing changed. I am using USBWebServer and phpMyAdmin. This is the index.php code that failed:
$servername = "127.0.0.1";
$username = "root";
$password = "usbw";
$databasetouse = "work times web database";
// Create connection
$mysqli = new mysqli($servername, $username, $password, $databasetouse);
// Check connection
if ($mysqli->connect_error) {
die("Connection failed: " . $mysqli->connect_error);
}
echo "Connected successfully";
I tried changing $servername to "localhost" and nothing changed. When I first tried to log in to phpmyadmin it showed that my password was usbw and my username was root.