时时商务社区
标题:
Windows Server 2008 R2和2012中PHP连接MySQL过慢的解决方法
[打印本页]
作者:
bewin83
时间:
2018-2-14 05:34
对比下面两个脚本的速度:
Windows 7 用 localhost 连接本地 MySQL,速度会很慢。
Windows 7 用 127.0.0.1 连接本地 MySQL,速度则是正常的。
my.ini里配置了
bind-address=127.0.0.1
用localhost连接本地MySQL: 速度慢
分析:
1.my.ini里配置
bind-address=127.0.0.1
时,Win7及其以上版本系统PHP用localhost连接MySQL耗时超过1秒,比用127.0.0.1连接慢了400倍.
2.my.ini里配置
bind-address=::1
时,Win7及其以上版本系统PHP用localhost连接MySQL速度是正常的,但用127.0.0.1连接又不正常了.
3.去掉bind-address配置,则用localhost或127.0.0.1连接MySQL速度都是正常的.
所以:在配置了
bind-address=127.0.0.1
的情况下,应该使用 127.0.0.1 连接本地 MySQL 数据库 。
安装 WordPress、phpMyAdmin 等 PHP 程序的时候默认使用 localhost 连接本地 MySQL 数据库,这时注意把默认的 localhost 改为 127.0.0.1。
另外,Windows 2008、2012 跟 Windows 7 存在同样的问题。
您可能感兴趣的文章:
基于Win2008 R2的WSFC实现 SQL Server 2012高可用性组(AlwaysOn Group)
图文详解Windows Server2012 R2中安装SQL Server2008
windows server 2008/2012安装php iis7 mysql环境搭建教程
SQL Server 2012降级至2008R2的方法
Sql Server 2008R2升级Sql Server 2012图文教程
欢迎光临 时时商务社区 (http://bbs.4435.cn/)
Powered by Discuz! X3.2