I'm trying to connect to a Mysql Bank remotely, through PDO + PHP. Mysql Bank is managed by a team, I do not have access to it. The Bank was created and the tables too. I was given the appropriate permissions to the bank by my user. However, when I try to connect to it via PHP + PDO it generates the following error:
Fatal error: Uncaught exception 'PDOException' with message 'SQLSTATE[HY000] [2005] Unknown MySQL server host 'xxx:3306' (2)' in xxx:8 Stack trace: #0 xxx(8): PDO->__construct('mysql:host=a1-o...', 'user', 'senha') #1 xxx: db_connect() #2 {main} thrown in xxx on line 8
We leave a tcpdump running in the Mysql environment and when we try to connect to the bank via PHP, there is no package there. But telnet closes on port 3306.
Mysql connection data
define('DB_HOST', 'xxx:3306');
define('DB_USER', 'xxx');
define('DB_PASS', 'xxxx');
define('DB_NAME', 'xxx');
<?php
/**
* Conecta com o MySQL usando PDO
*/
function db_connect()
{
$PDO = new PDO('mysql:host=' . DB_HOST . ';dbname=' . DB_NAME . ';charset=utf8', DB_USER, DB_PASS);
return $PDO;
}
?>
Could someone help me?