error 2002 (connection attempt failed)
My apologies for the noobie question here. I’ve spent many hours trying to figure this out, but I just can’t seem to figure it out. I’m new to MySQL. I’ve setup a LAN webpage with simple PHP that will connect to MySQL: www.jeremyjcanfield.com/musictable1_lan.php. MySQL Server is running on my computer 192.168.0.10. Using a different computer in my LAN, 192.168.0.101, I go to www.jeremyjcanfield.com/musictable1_lan.php, and get error 2002 (connection attempt failed). If I log into MySQL Workbench, and go to Server Status, the server status is Running. I’ve turned off windows firewall on both 192.168.0.10 and 192.168.0.101. I’ve put my router into DMZ, so that it doesn’t use a firewall and processes all traffic, so I should be able to have traffic on port 3306. These computers in my LAN are on the same subnet. Both computers are Windows 7.
If it helps, I also set up a WAN webpage, so that remote users will be able to connect to MySQL server through the PHP over the internet, here: www.jeremyjcanfield.com/musictable1_wan.php.
Here is the PHP code I’m using:
<?php
$hostname="192.168.0.10";
$username="root";
$password="here I have my correct password";
$database="test1";
$link = mysql_connect($hostname, $username, $password, $database);
if (!$link) {
die('Connection failed: ' . mysql_error());
}
?>
Subject
Written By
Posted
error 2002 (connection attempt failed)
September 11, 2014 06:17PM
September 12, 2014 01:43AM
September 12, 2014 05:56PM
September 12, 2014 07:18PM
September 13, 2014 06:22AM
September 13, 2014 09:15AM
September 13, 2014 10:00AM
September 13, 2014 01:10PM
September 13, 2014 02:11PM
September 13, 2014 04:32PM
September 13, 2014 04:33PM
September 13, 2014 07:10PM
September 13, 2014 08:06PM