mysql is a server like any other http or web server. for speed and bandwidth reasons, its ideal to run the mysql server on the same machine or the same local network as the computers that need to access the database. however if this is impossible, it is possible to access mysql servers on other networks and store and retreive data in the same manner as you would on a local server...
//access db on local machine
mysql_connect('localhost', 'username', 'password');
//access db on a remote machine
mysql_connect('12.34.56.78', 'username', 'password');
in both examples you will have a link to a mysql server. php doesnt really care where it is located, just that it can connect and communicate with it.