Fixing Database Connection working slow on windows 8

Today I just want to share one useful tip on fixing slow database connection issue on Windows 8 machines.Today I got this issue on my machine after new installation of LAMP stack. After playing around with the configurations of database config file I find a simple fix, We just need to replace the “localhost” with “127.0.0.1” IP, that is it.
With this little trick, you can get rid of the delay between each query execution.

Instead of this:
$mysqli = new mysqli("localhost", "user", "password", "database");

Use this:
$mysqli = new mysqli("127.0.0.1", "user", "password", "database");

If you want to fix the delay on PHP MyAdmin you need to add the following line at the bottom of the “xampp/phpMyAdmin/config.inc.php” file.

$cfg['Servers'][$i]['host'] = '127.0.0.1';

I hope you like this Post, Please feel free to comment below, your suggestion and problems if you face - we are here to solve your problems.

Arjun
I am Arjun from Hyderabad (India). I have been working as a software engineer from last 7+ years, and its my passion to learn new things and implement them as a practice. Aside from work, I likes gardening and spending time with pets.
DMCA.com Protection Status