0

My Web site takes a long time to load and am presented with the following errors:

Warning: mysql_connect(): MySQL server has gone away in C:\xampp\htdocs\test\inc\scripts\mysql_connect.inc.php on line 9

Warning: mysql_connect(): Error while reading greeting packet. PID=2256 in C:\xampp\htdocs\test\inc\scripts\mysql_connect.inc.php on line 9

Warning: mysql_connect(): MySQL server has gone away in C:\xampp\htdocs\test\inc\scripts\mysql_connect.inc.php on line 9

Fatal error: Maximum execution time of 30 seconds exceeded in C:\xampp\htdocs\test\inc\scripts\mysql_connect.inc.php on line 9

The code I am using:

<?php
$conn_error = 'Colud not connect.';

$mysql_host = "localhost:8080";
$mysql_user = "Harry";
$mysql_pass = "";

$mysql_db = 'testsite' ;
mysql_connect($mysql_host, $mysql_user, $mysql_pass) or die("Couldn't Connect") ;
mysql_select_db($mysql_db) or die($conn_error);

echo 'Connected!' ;

?>

Any idea why this is happening?

Funk Forty Niner
  • 74,450
  • 15
  • 68
  • 141
  • 2
    Sounds like your database server has gone away. Maybe it's just on holiday, try again next week. – deceze Apr 13 '13 at 16:00
  • possible duplicate of [MySQL server has gone away - in exactly 60 seconds](http://stackoverflow.com/questions/1644432/mysql-server-has-gone-away-in-exactly-60-seconds) –  Apr 13 '13 at 16:01
  • You don't need to use port number `$mysql_host = "localhost";` – Amir Apr 13 '13 at 20:19

1 Answers1

1

Just mean that your website can't reach the MySQL Server. Maybe it's not started or if so it's not correctly working or not reachable.

Doc: http://dev.mysql.com/doc/refman/5.0/en/gone-away.html

TheEwook
  • 11,037
  • 6
  • 36
  • 55