This is not a firewall problem. The error message is typical for MySQL when you can connect to the server but the account doesn't exist or if the account is not allowed to connect to the specified database from the a given host. You need to connect to the MySQL server as an admin and issue something like:
Code:
GRANT ALL ON `contact`.* TO 'anandi'@'localhost' IDENTIFIED BY 'anandi';
You may want to have less permissions than ALL, but that is what I usually have on my development box.
As an alternative you may try different host names in the connection URL. Sometimes it helps to use the real host name or ip address. It all depends on which permissions you have granted to the account.