I have some issues with my PDO connexion. I try to connect my android phone to my database which is on a Raspberry PI 3.
I have in the PI folder /var/www/html/ some php files.
One of them manages the connexion to the database.
I've tried to connect via phpmyadmin with user and password and it works fine on Pi and on other computers in network.
<?php
function connexionPDO()
{
$login = "XXXXXX";
$mdp = "YYYYYYYYYYY";
$bd = "ZZZZZZ";
$serveur = "192.168.0.12";
$port = "3307";
try
{
echo "tentative de connexion BWAAAAAAA";
$conn = new PDO("mysql:host=$serveur;dbname=$bd", $login, $mdp);
echo "BWA connexion reussie";
return $conn;
}
catch(PDOException $e)
{
echo "BWA errrrreuuuuuur";
print "Erreur !%".$e->getMessage();
die();
}
}
?>
In the logcat in Android studio i get :
BWA errrrreuuuuuurErreur !%SQLSTATE[HY000] [2002] Connection refused
Can someone explain to me where is the problem ? ty Evo