WAMP and mysqli::real_connect(): (HY000/2002)?

只谈情不闲聊 提交于 2019-12-11 12:09:58

问题


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


回答1:


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



来源:https://stackoverflow.com/questions/34141469/wamp-and-mysqlireal-connect-hy000-2002

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!