0

I want know the reason why this code is not running ?
My Wampserver IP address is 127.0.0.1:8080 or localhost:8080 !
The username is the default "root", but I changed my password to "abcd" !

<?php

/**
 * @author 
 * @copyright 2011
 */

   $con = mysql_connect('127.0.0.1:8080','root','abcd');
   if (!$con) {
    die('Could not connect: ' .mysql_error());
   }
?>

Errors when the file is run !!! :O

Warning: mysql_connect() [function.mysql-connect]: MySQL server has gone away in C:\wamp\www\PHPgiri\4.php on line 8

Warning: mysql_connect() [function.mysql-connect]: Error while reading greeting packet. PID=7828 in C:\wamp\www\PHPgiri\4.php on line 8

Warning: mysql_connect() [function.mysql-connect]: MySQL server has gone away in C:\wamp\www\PHPgiri\4.php on line 8
Could not connect: MySQL server has gone away

Please help !

4
Contributors
5
Replies
6
Views
5 Years
Discussion Span
Last Post by Stefano Mtangoo
0

Actually I have IIS installed on my system which is the localhost.
I have set Wampserver to function from port 8080.
Please tell can I access port 3306 from there ???

0

If you set wampserver to 8080, that means that apache will run on 8080. Unless you changed something mysql will be accessible on the default port 3306. So just remove the :8080 from your host in the mysql_connect.

0

when i used this i got this message when i run the page ,"Could not connect: No connection could be made because the target machine actively refused it. " can anyone help

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.