StudentX
StudentX

Reputation: 2323

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

Upvotes: 1

Views: 6876

Answers (1)

StudentX
StudentX

Reputation: 2323

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

Upvotes: 1

Related Questions