Yes, I've allowed connecting from remote server and it works ok. I don't know what to do now...
Please notice that I cannot just edit /admin/config.php file and set $servername to the IP address of first server, because most of the mysql info should be taken from the second server (and it should remain 'localhost').