Scale up as you grow — whether you're running one virtual machine or ten thousand.

From GPU-powered inference and Kubernetes to managed databases and storage, get everything you need to build, scale, and deploy intelligent applications.

Hi guys ,
I have a problem connecting the database from a database VPS server to another VPS server. My problem is that I am writing a web page that has a connection to a database. When I practice connecting the database from XAMPP ,on my local computer, to the database server VPS, it works fine, and there are no problems. But when I install Apache + PHP on another VPS and then connect to the database VPS server, it throws an error like below:
Connection failed: SQLSTATE[HY000] [2003] Can't connect to MySQL server on '161.xxx.xxx.xxx' (13)
'161.xxx.xxx.xxx this is the database server IP that I want to access. I tried to set up mysql remote access, and tried to check if it can control from web VPS to database VPS, it works normally.
Here is the config.php file I used PDO to connect to the database:
<?php
$host = "161.xxx.xxx.xxx";
$username = "username";
$password = "my_pass";
$dbName = "my_db";
try{
$conn = new PDO("mysql:host=$host; dbname=$dbName", $username, $password);
$conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
echo "Connected successfully";
}catch(PDOException $e){
echo "Connection failed: " . $e->getMessage();
}
$conn = null;
?>
Can you help me how to connect the database on the website from 1 VPS to a VPS containing the database. And these 2 VPSs are from the digital Ocean.
Stefan
patrickniessenmakezens
donmez.dogan
41809fc37fa549b98a34934d238850
Código de referido Binance
yolanda smith
b1cfd497da4348d08019b0315db7a0
Deeraj EA
1ddffddc31ea402a842dcb134f6134
bec1cd09097d477da725b161a4066f
Anjanesh Lekshminarayanan
Anjanesh Lekshminarayanan