IIS + PHP + MySQL:连接尝试失败,因为连接方没有(尝试通过tcp:// localhost:3306连接) [英] IIS + PHP + MySQL: A connection attempt failed because the connected party did not (trying to connect via tcp://localhost:3306)

查看:960
本文介绍了IIS + PHP + MySQL:连接尝试失败,因为连接方没有(尝试通过tcp:// localhost:3306连接)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在运行Windows,安装了IIS 7.5,PHP 5.3(FastCGI)。尝试连接到MySQL并收到错误连接尝试失败,因为连接方在一段时间后没有正确响应,或者建立的连接失败,因为连接的主机无法响应。

I'm running Windows, having installed IIS 7.5, PHP 5.3 (FastCGI). Trying to connect to MySQL and getting an error "A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond.".

开始使用XAMPP开发项目,但需要将其移至IIS(因为AD身份验证)。 MySQL从XAMPP堆栈运行。我已经将IIS映射到与Apache2相同的docroot,但是映射到另一个端口。使用Apache2主机访问测试页面服务器时 - 没有问题,但是当访问IIS + PHP FCGI页面时 - 我收到此错误。

Started to develop a project with XAMPP, but had the requirement to move it to IIS (because of AD auth). MySQL is running from XAMPP stack. I've mapped IIS to the same docroot as Apache2's, but to another port. When accessing test page server with Apache2 host - there is no problem, but when accessing IIS + PHP FCGI page - I get this error.


  • MySQL的独立安装有帮助吗?

  • 你的建议是什么?

推荐答案

在您的脚本中,尝试使用127.0.0.1而不是localhost作为MySQL主机。

In your script, try using "127.0.0.1" instead of "localhost" as MySQL host.

如果这解决了您的问题,您可以将以下行添加到/ Windows / System32 / drivers / etc / hosts中的hosts文件中:

If this solves your problem you can add the following line to your hosts file in /Windows/System32/drivers/etc/hosts:


127.0.0.1 localhost

127.0.0.1 localhost

之后你可以使用localhost 。

After that you will able to use "localhost".

这篇关于IIS + PHP + MySQL:连接尝试失败,因为连接方没有(尝试通过tcp:// localhost:3306连接)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆