Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

enter image description hereI have installed the WAMp server on my windows XP machine.

When I am trying to connect to DB it give the following error.

Warning: mysql_connect() [function.mysql-connect]: [2002] No connection could be made because the target machine actively (trying to connect via tcp://localhost:3306) in C:\wamp\www\demo.php on line 2

I have attached my list of active services. You can see that I no service installed at port 80.

So, When i have installed the WAMP, I have to use http://localhost:81 for my root folder.

My PHP myadmin is working fine, but don't know how. enter image description here

have anyone faced this type of problem before.?

Please let me know if you have solution for this..

share|improve this question
CMD propmpts allow you to copy and paste. To copy: right click, mark, highlight text, [enter]. To paste: right click, paste. This should help so you don't have to upload massive (unsearchable) images. – Chris S Oct 11 '11 at 13:51

This question is very confused.

Title suggests problem connecting to port 3306 (which is where mysql usually hangs out). There is no list of active services. What does a service at port 80 have to do with anything?

I have to use http://localhost:81 for my root folder.

Why do you have to use port 81? What do you mean by your "root folder".

I suspect the problem is that mysqld is running OK (since you connect using PMA) but the client attaches special significance to the name 'localhost' and will try to use a filesystem socket instead of a network socket.

In a DOS shell, run 'netstat -a' to check if mysqld really is listening on port 3306 - and on which addresses. Try connecting to the address/port listed in netstat (use NOT localhost)

share|improve this answer
Sorry forgot to add screen shot, I have also attached the screen shot with "netstat -a" command. I am not able to find the 3306 port. – Avinash Feb 18 '11 at 17:08
Thanks for the help, I have solved my self, will post the solution sortly... – Avinash Feb 18 '11 at 17:12
up vote 1 down vote accepted

in mysql.ini file port was defined to 3307 I have changed it to 3306 and its works great.

@symcbean : thanks for your time..

share|improve this answer

I added a rule to the Norton Internet Security program. The rule was that it was OK to allow my PC (given by the IP address) to use TCP for ports 8080 and 3306 for Local use. That worked fine today to fix the problem.

I was using Windows 7, PHP and PhpED Pro 6.1 in October 2011 when I had the problem of connecting to the MySQL DB on my PC.

share|improve this answer

Did you open the port in Windows Firewall? Even connecting back to localhost:3307 will get blocked if it isn't opened in the firewall. 3306 may have been opened by the installer already, which is why it works.

share|improve this answer
How to open that port? – Avinash Feb 19 '11 at 3:50
Administrative Tools | Windows Firewall. Add an inbound rule and select port as the type. Then enter the port you want and finish the wizard. – ed209 Feb 19 '11 at 19:40

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.