I need to connect a website A in a server A to a mysql database B in a server B (cpanel). I'm using this code for my connection:
$myServer = "host_B";
$myUsername = "user_database_B";
$myPassword = "pass_database_B";
$myDatabase = "name_database_B";
$con = mysqli_connect($myServer,$myUsername,$myPassword );
I'm getting this error: "Warning: mysqli_connect(): (HY000/2002): A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond."
I also have the port 3306 opened and in server B I have allowed the ip of the website A for remote connections to the database.
I'm just wondering if you can help me and give me ideas what the problem could be.