assuming that you intend to use php/mysql ...
<?php
//header stuff
$dbs = 'domain1.com';//or ip-address
$dbu = 'remoteUSR'; //must be granted access from domain1.es !
$dbp = 'rUSRpw';
$hdl=MYSQL_CONNECT($dbs,$dbu,$dbp) //or mysqli ...
or die('#'.mysql_errno()." <B>$dbs</b> ".mysql_error());
//do the queries & show results
//....
?>
this script can run anywhere