Click here to Skip to main content
15,892,059 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
PHP
<?php

// $host="localhost";
$username="root";
$password="";


$dbh=new PDO("mysql:host=localhost:8080; dbname=hemaslink",$username,$password);
if($dbh)
{
echo 'connected';
}
?>


it gives me an error like

Warning: PDO::__construct(): MySQL server has gone away in C:\wamp\www\Projects\connect.php on line 8


Fatal error: Uncaught exception 'PDOException' with message 'SQLSTATE[HY000] [2006] MySQL server has gone away' in C:\wamp\www\Projects\connect.php on line 8
Posted
Updated 10-Mar-15 20:32pm
v2

1 solution

There are lot of explanations about the error here: http://dev.mysql.com/doc/refman/5.0/en/gone-away.html[^]
My guess i your case is that the port number is wrong (the default MySQL port is 3306) and because of this the server was not found...
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900