I am very puzzled on using the mysqli_connect() and mysqli_connect_error() in my PHP. I don’t know where to look for the problem or how to solve, is it php.ini or my.ini config? Need help.
I am trying to migrate from an older server setup. I have a newly installed MariaDB 11.4.2 and PHP 8.3. The old setup was under MariaDB 10.3.13 and PHP 7.2.22.
I do this simple test:
<?php
echo "Connecting...<br>";
$con = mysqli_connect("localhost","user","pass","db");
if (mysqli_connect_errno()) {
die("Failed to connect to MySQL: " . mysqli_connect_error());
}
echo "Success!";
?>
with the correct username and password, I have the result:
Connecting...
Success!
but when I intentionally provided the wrong username or password, I only get:
Connecting...
why does it not show the failed msg?
In my old MariaDB and PHP, if provided wrong username/password, I correctly get:
Connecting...
Failed to connect to MySQL: Access denied for user 'user'@'::1' (using password: YES)