I want to connect MySQL database using PDO Extension. I am using PHP 5.4
$db = new PDO('mysql:host=localhost:8080;dbname=films_db;charset=UTF-8', 'root', '');
$query = "SELECT * FROM employee";
$result = $db->query($query);
while($row = $result->fetch(PDO::FETCH_ASSOC)) {
print_r($row);
}
$result->closeCursor();
But, my WAMP server is not responding. I am not getting any result. Its “Waiting for localhost” state and getting server timeout error.
Pls help me to resolve this. Thanks.
Port 8080 is for http,
normally it does not used for mysql.
and the default mysql port is 3306.
You might need to check your mysql setting to “confirm” the actual port being used.
Beside this, you might need to check how many record in the table employee.
If millions of records, it might be the reason it takes time to load.