when connecting to a remote mysql host if no port is specified then the default port is assumed so as long as the remote host has not changed the port then you have no need to add it to your script.
And as stated the only difference in your script will be the host, instead of using localhost you will use the ip or host name for the new host.