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");
$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 “
$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.