如何連接到the demo phpmyadmin server在PHP?我的代碼看起來像這樣。連接到遠程mysql服務器
<?php
$host = 'http://demo.phpmyadmin.net/STABLE/';
$dbname = 'shubham';
$user = 'root';
$pass = '';
// Attempt to connect to database.
try {
$DBH = new PDO("mysql:host={$host};dbname={$dbname}", $user, $pass);
} catch(PDOException $e) {
echo $e->getMessage();
}
?>
,但我得到這是我的錯誤
QLSTATE[HY000] [2005] Unknown MySQL server host 'http://www.demo.phpmyadmin.net/STABLE/' (1)
幾件事:1)服務器是否在默認端口上運行? 2)你不能通過HTTP連接,除非你想看到PhpMyAdmin。 – Trent 2013-03-02 06:17:19