I have mysql 8.0.15 for windows and I'm trying to connect from remote php webSite but always getting
2002: Connection refused
The code I use to test the connection is very simple
$dbHost = "HOST";
$dbUser = "root";
$dbPass = "password";
$dbDB = "DBNAME";
$dbPort = "9999";
echo "Conectando a $dbHost,$dbUser,$dbPass,$dbDB,$dbPort ";
$link = mysqli_connect($dbHost,$dbUser,$dbPass,$dbDB,$dbPort);
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);
I also try host:port and p:host:port and always getting the same error message.