Connection failed: Can't connect to MySQL server on 'sql205.epizy.com' (101)

hello i,m trying to connect to my database using PhP, i gen a error and i don’t understand why!

My code is:

  1. <?php
  2. $servername = “sql205.epizy.com”;
  3. $username = “???”;
  4. $password = “???”;
  5. $db= “???”;
  6. // Create connection
  7. $conn = new mysqli($servername, $username, $password,$db);
  8. echo date(“h:i:sa”).“
    ”;
  9. // Check connection
  10. if ($conn->connect_error) {
  11. die("Connection failed: " . $conn->connect_error);
    
  12. }
  13. echo “Connected successfully”;
  14. ?>

??? = the info i found in my cPanel
i used the pass that I use to conn to the FTP. the FTP conn works

OUTPUT:
12:48:21pm
Connection failed: Can’t connect to MySQL server on ‘sql205.epizy.com’ (101)

tried using HeidiSQL as well with no success

I’ve checked your script and it looks like it can connect without any problems. Just note that the script can only work with the database on your account, you cannot run the script on your own computer and use it to connect to the database hosted here. Remote MySQL is a premium only feature.