So I have a PHP file hosted on Namecheap server.
$db=mysql_connect (\"ipaddress\", \"user\", \"pass\") or die (\'I cannot connect to the database because:
If you are using MySQL for your database solution (which seems odd due to the usage of IIS on a Windows Server operating system)
Try running (As Root):
GRANT ALL ON Database.* TO Username@'IPAddress' IDENTIFIED BY 'PASSWORD';
Where the second is the permissions that you are granting on, this is a place holder for all
This will allow a connection from the IP you specify
also A problem is with connecting to your MySQL engine from inside your network, you will naturally connect from an internal IPV4 Address (192.168.0.x for example) this does not require portforwarding. BUT if you are using:
mysql_connect('WANIP', 'User', 'password');
you will have to forward port 3306
to your server. http://www.portforward.com for assistance.
Edit:
http://dev.mysql.com/doc/refman/5.0/en/can-not-connect-to-server.html
The manual for this subject, this may provide some assistance
If you are using Microsoft SQL Server check this link out:
http://blogs.msdn.com/b/walzenbach/archive/2010/04/14/how-to-enable-remote-connections-in-sql-server-2008.aspx