Calling MYSQL from a different IP address?

Hi,

If a PHP program is created to be hosted on multiple websites, and those websites don’t have any kind of database, how would the program talk to a MYSQL database which is hosted on an entirely different backbone / ip / etc?

The default is ‘localhost:3306’. So would I change this to** mywebsite.com:port#**?
Even if I were to do that, I would probably have to allow for certain PHP files to be accessed by outside sources, which could be a security threat? (another topic).

Thanks!