If you want to use remote database means database hosted on other
cPanel Web server then you need to replace localhost by ip of remote cpanel server. And other setting will be as given below.
$myServer = "Ip of remote server";
$myUser = "User Name of remote database ";
$myPass = "Password remote database user";
$myDB = "Remote database Name";
Also you will have to add the ip of your server at remote cPanel >> "Remote Database Access Hosts" so that remote database host will allow your host to access the database.
Glenn....