Slow performance MySQL on Windows Server 2012 with IIS 8

IIS 8 LogoAfter installing a MySQL/PHP combo  by using the Web Platform Installer on a Windows Server 2012 host with IIS 8 installed I noticed slow initial response time of loading webpages. I assumed it was PHP in need of some tweaking on the Windows platform but after running some performance tests the problem was not related to PHP.

Because PHP scripts without a MySQL connection were running very fast I digged in the config file of the website using a MySQL database. I changed the settings below and my speed improvement went from +1000ms to 90ms.

Default is set to localhost.

/** MySQL hostname */
define('DB_HOST', 'localhost');

Change this to 127.0.0.1

/** MySQL hostname */
define('DB_HOST', '127.0.0.1');