Loving Coding & Visual Design

Vista下无法连接Mysql5的问题

没想到在Vista SP2 下安装Mysql5会遇到麻烦,安装过程都很顺利,Dos下访问mysql也完全没问题。可是通过Apache访问phpmyadmin就是不行,提示如下错误:
A connection attempt failed because the connected party did not (trying to connect via tcp://localhost:3306)

开始以为是mysql的版本问题,我先装的是5.1, 然后是5.43、5.0,均出现同样的问题。也根据网上流传的Vista下Mysql5.0无法运行的帖子,试过用ResHacker.exe修改MySQLInstanceConfig.exe,还是没能解决。

后来检查过VIsta的防火墙设置,3306端口已经打开,没有发现问题。开始估计问题出在 PHP脚本上,根据mysql_connect的官方解释:
Note: Whenever you specify "localhost" or "localhost:port" as server, the MySQL client library will override this and try to connect to a local socket (named pipe on Windows). If you want to use TCP/IP, use "127.0.0.1" instead of "localhost". If the MySQL client library tries to connect to the wrong local socket, you should set the correct path as Runtime Configuration in your PHP configuration and leave the server field blank.

把localhost改为127.0.0.1,一起正常~



下一页


最 近 文 章

  1. RewriteRule里正则表达式减号字符的顺序问题 - Wed, 20 Jan 2010 10:17:40 +0000
  2. Discuz7用firefox无法登录 - Tue, 19 Jan 2010 06:03:51 +0000
  3. PHP5成员重载错误: Indirect modification of overloaded property has no effect - Thu, 14 Jan 2010 05:56:26 +0000
  4. 悲哀啊,如果Google关闭谷歌中国 - Wed, 13 Jan 2010 10:40:40 +0000
  5. 用Curl登录Plesk后台备份文件 - Mon, 11 Jan 2010 04:23:46 +0000
  6. [巾*(穴/登)] - Sat, 09 Jan 2010 03:49:49 +0000
  7. Hello WP again! - Mon, 17 Aug 2009 23:13:27 +0000
  8. 用HTTP_Request2替换Curl更新Twitter - Fri, 08 Jan 2010 03:57:12 +0000
  9. IE8上window.onresize的问题 - Tue, 05 Jan 2010 05:43:21 +0000
  10. 09年的不许 - Fri, 18 Dec 2009 15:57:31 +0000