mysql_connect 执行时间较长
我在 php 中有以下脚本来登录 mysql
$db_host="localhost";
$db_user="root";
$db_pass="123";
$dbc=mysql_connect($db_host,$db_user,$db_pass) OR DIE (mysql_error());
$dbs=mysql_select_db($db_name) OR DIE (mysql_error());
这个脚本工作正常,现在我重新安装操作系统 现在我有 Windows 7 和 iis7 以及 PHP 版本 5.3.2 和 PHP 5.3.2 版本。 mysql服务器5.1 但现在该脚本无法正常工作并且需要花费日志时间来执行。
谢谢
i have following script in php to login to mysql
$db_host="localhost";
$db_user="root";
$db_pass="123";
$dbc=mysql_connect($db_host,$db_user,$db_pass) OR DIE (mysql_error());
$dbs=mysql_select_db($db_name) OR DIE (mysql_error());
this script was working fine, now i reinstall the O.S
now i have windows 7 and iis7 and PHP Version 5.3.2 & mysql server 5.1
but now this script is not working and taking log time to execute.
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
在 Windows 7 上
localhost
解析为::1
,据我所知,MySQL 不支持 IPv6。直接连接到
127.0.0.1
可以解决这个问题;但您可以编辑hosts
文件将localhost
解析为127.0.0.1
,然后localhost
也可以工作:::1 localhost
127.0.0.1 localhost
On Windows 7
localhost
resolves to::1
, and MySQL doesn't support IPv6 as far as I know.Connecting directly to
127.0.0.1
resolves this problem; but you can edit thehosts
file to resolvelocalhost
to127.0.0.1
, thenlocalhost
will work too:::1 localhost
127.0.0.1 localhost
使用:(
或任何其他 IP,例如
192.168.1.2
),而不是主机名 (localhost
)。Use:
(or any other IP, such as
192.168.1.2
), instead of a hostname (localhost
).您还可以查看此链接: http ://dev.mysql.com/doc/refman/5.7/en/server-options.html#option_mysqld_skip-name-resolve
--skip-name-resolve 选项
You can also look at this link : http://dev.mysql.com/doc/refman/5.7/en/server-options.html#option_mysqld_skip-name-resolve
--skip-name-resolve option