简体   繁体   中英

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

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM