I'm kinda new in web development and i'm facing this problem with a remote server.
I can connect with MySQL in the remote server via SSH, using the the remote server's domain and everything works fine but for some reason it doesn't work on my php files.
This is my conection code:
$servername = "domain_name";
$username = "user";
$password = "password";
$database = "db_name";
$port = 3306;
// Create connection
$conn = new mysqli($servername, $username, $password, $database, $port);
// Check connection
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
But the only thing i get in my file is:
Warning: mysqli::mysqli() [mysqli.mysqli]: (HY000/2003): Can't connect to MySQL server on 'DOMAIN' (111)
As a sidenote i've tried:
-using the ip address of the server instead of the domain name
-changing the port to 3307
How can i fix it?
Also, i don't have access to the server itself