Step 1.
mysql_connect("server_host_name","user","pass");
When you are on a server, you use localhost to refer to that host. When you must connect to a database on another server, use that server's host name or IP address.
Step 2.
You also have to grant access to MySQL from an external host in the MySQL security tables. Look on the mysql site for more information on how to do that.
Good luck.