In short, I have this issue:
local server --> remote db server : Connected successfully
other remote server --> remote db server : Connection refused
The story:
Because of my web hosting (iPage) has limited resources for shared hosting plan, especially for Mysql, I decided to connect one of my websites (WordPress) to remote MySQL server, So I got another shared hosting plan based on cPanel from another provider, when I complete setting up my database and add my remote host (iPage) to access host settings in cPanel (actually I also added % to access host just for testing :)) and I added the new credentials to wp-config.php, and go to my website I noted that the website couldn't connect to the database. here I started to troubleshooting, I used this PHP script to check the errors,
<?php
$servername = "my_remote_host_ip";
$username = "my_db_user";
$password = "my_db_pass";
// Create connection
$conn = new mysqli($servername, $username, $password);
// Check connection
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
echo "Connected successfully";
?>
it gives me:
Connection failed: Connection refused
But when I run this script from local (LAMP) server it gives me:
Connected successfully
also everything works fine, it connects from my ubuntu laptop via MySQL workbench and via terminal
mysql -h my_remote_host_ip -u my_db_user -p
Do you have any ideas about this issue
TIA