This problem occurs when the MySQL service is not running and you're trying to connect to the mysql database.
To resolve this in Windows,
Start >> type 'services' and open it.
Find the MySQL service. Probably with name MySQLxx. xx being the version.
eg. MySQL56, MySQL57 etc
Start the service and now try to connection to database.