How to connect to mysql database on another server using php Find out the IP address of the server A where your scripts will be uploaded. Do not forget to change the localhost to the ip address of the Server B in mysql_connect() or mysqli_connect() method. Now go the control panel of the Server B