With the connection to the remote server, many hosting companies do not allow remote connections. Some will allow you to add your IP has a host that is allowed to have access to the MySQL on the hosts's server so that you can use a GUI app other than PhpMyAdmin to connect from your desktop.
Either way, the best practice for me has been to set up my testing server on the local machine to mirror my production server exactly. My production server uses "localhost" to access MySQL and so does my testing server... so I actually only declare the variables once and then just FTP my entire site. I then dump the local machine mySQL and then import to the production server. That way, everything on my local machine is exactly how it will appear online in the production environment.
The key is to make the local machine's MySQL be exactly the same - same database name, same user name, same password, etc.