php mysql从另一台服务器连接数据库

Connect Database from another server in mysql and php I use this :

<?php
$db = mysql_connect("mysite.com", "theusername", "proud");
mysql_select_db("theotherserverDB",$db);

?>

need to Fix?

<?php

mysql_connect("mysite.com:3306", "admin", "1admin") or die(mysql_error());
echo "Connected to MySQL<br />";

?>

Just run it and see if it works.

Before making the connection.. you should reserve the domain or IP address of the server you are about to communicate from....

If you are using cpanel you can do this by clicking on remote MYSQL under databases.

Good luck...