Jump to content

mysql_connect returns error message


richardbc

Recommended Posts

httpd-2.2.17-win32-x86-openssl-0.9.8o

php-5.3.6-Win32-VC9-x86

mysql-5.5.11-win32

 

PHP code:

 

$dbcnx = mysql_connect('localhost','root','admin');

 

Error message:

 

No connection could be made because the target machine actively refused it.

 

I used mysql.exe -u root -p to verify that mysql is working and using the right username and password.

 

Any ideas how to fix it?

 

Thanks,

 

Richard

 

Link to comment
Share on other sites

Forgot it was named differently on Windows, but that's the same config file.

I don't know what you mean by socket being set to mysql, but make sure the port is set to 3306.

This is not a php coding problem, I'm not entirely sure it's a MySQL configuration problem. If the port checks out and you're certain you don't have a firewall issue, maybe look into permissions next. Make sure that Apache httpd is allowed to open a socket and MySQL is allowed to as well.

Maybe try to telnet to localhost 3306 to make sure it is responding.

I'm just throwing out guesses based on my minimal Windows server administration experience, figured they couldn't hurt.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.