I'm not sure why you are getting this error when connecting to your MySQL db, the error is just saying that it cannot connect. If you are testing this locally then the problem might be that you do not have remote access to the MySQL db. I think you would get this same error if you browsed to the file directly. If you are certain that your username, password and other values are correct you may need to talk with your host to see why you are not able to connect.