我最近从 Windows 7 升级到 Windows 10,并安装了 WAMP。 这是我第一次使用 WAMP。
我在我的一个 Codeigniter 项目中收到以下错误消息 我在 Windows 7 安装程序中工作,但我不知道该怎么做。该页面不断加载和加载,然后失败并显示错误消息。
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.
进一步完成页面,这是我收到的消息:
Unable to connect to your database server using the provided settings.
主机名、用户名、密码和数据库是正确的。
但如果我将 dbdriver 从 mysqli 更改为 mysql 然后网站加载,但出现以下错误.
Message: mysql_connect(): The mysql extension is deprecated and will be removed in the future: use mysqli or PDO instead
我做错了什么?
注意:哦,是的,我可以访问 phpmyadmin
最佳答案
我想通了,我希望这个解决方案能帮助遇到与我相同问题的人。
由于我的服务器运行缓慢,我一直在寻找解决方案,我尝试了很多方法但没有任何效果,然后我将数据库连接的主机名从 localhost
更改为 127.0。 0.1
并且有效。此更改使 mysqli 正常工作,并使我的服务器更快
关于php - WAMP 和 mysqli::real_connect(): (HY000/2002)?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34141469/