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
https://forums.phpfreaks.com/topic/233756-mysql_connect-returns-error-message/
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.

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.