WAMP和mysqli :: real_connect():(HY000 / 2002)? [英] WAMP and mysqli::real_connect(): (HY000/2002)?

查看:1599
本文介绍了WAMP和mysqli :: real_connect():(HY000 / 2002)?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

最近我从 Windows 7 升级到 Windows 10 ,并安装了 WAMP
这是我第一次使用WAMP。



我在我的 Codeigniter 项目中收到以下错误消息在windows 7设置和我不知道该怎么做。


消息:mysqli :: real_connect():(HY000 / 2002) ):连接尝试失败,因为连接的方在
时间后没有正确响应,或者建立的连接失败,因为连接的
主机未能响应。


< blockquote>

进一步完成的页面这是我得到的消息:


无法连接到

password 是正确的。



但是如果我将 dbdriver 更改为 mysqli ,然后网站加载,但出现以下错误。


消息:mysql_connect():mysql扩展已弃用,将来会删除
:use mysqli or PDO instead


我做错了什么?



注意:哦,是的,我可以访问 phpmyadmin

解决方案

我想出来,我希望解决方案能帮助面对同样问题的人。 b
$ b

由于我的服务器运行缓慢,我正在寻找解决方案,我尝试了很多东西,但没有什么工作,然后我更改了主机名的数据库连接从 localhost 127.0.0.1 ,它工作。此更改使 mysqli工作,并使我的服务器更快


I upgraded from Windows 7 to Windows 10 recently, and installed WAMP. This is my first time working with WAMP.

I am getting following error message in one of my Codeigniter project I was working in windows 7 setup and I don't know what to make of it. The page keeps on loading and loading and then fails with the error message.

Message: mysqli::real_connect(): (HY000/2002): 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.

Further done the page this is the message I get :

Unable to connect to your database server using the provided settings.

The hostname, username, password and database are correct.

But if I change dbdriver to mysql from mysqli then the website loads, but with the following error.

Message: mysql_connect(): The mysql extension is deprecated and will be removed in the future: use mysqli or PDO instead

What am I doing wrong ?

Note: Oh and yes, I can access phpmyadmin

解决方案

I figured it out and I hope the solution will help someone facing the same problem as me.

Since my server was running slow, I was searching for solutions, I tried a lot of thing but nothing worked, then I changed host name for the database connection from localhost to 127.0.0.1 and it worked. This change made mysqli work and it made my server a lot faster

这篇关于WAMP和mysqli :: real_connect():(HY000 / 2002)?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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