HubsInfo Network

Connect to an external MySQL server with PDO (without delay)

0 Members and 1 Guest are viewing this topic.

Add one space between mysql: and host (server IP address or dns name)
ex: "mysql: "


Code: [Select]
$conn = new PDO('mysql:host=123.4.5.6;dbname=test_db;port=3306','username','password');
?>

it will fail no matter what. However if you put a space between mysql: and host like this:

$conn = new PDO('mysql: host=123.4.5.6;dbname=test_db;port=3306','username','password');
?>


--
Ref:
http://php.net/manual/ro/pdo.connections.php#118381
http://stackoverflow.com/questions/17630772/pdo-cannot-connect-remote-mysql-server