[SQL3.10] How do I connect to another database on another server from my PHP script?

A connection is made to a database with the usual statement:

mysql_connect('localhost','USERNAME','PASSWORD');

Where 'localhost' is the database on the same web server as the PHP script.

If you want to connect to a database to another web server you would replace localhost' to that of the IP address of the web server.

The web server where a database resides can be found by moving your mouse over the "Go" link for the Temp Web Address or clicking the link so the IP is displayed in the browser address bar, within the Hosting cPanel v7.5 control panel.

Was this answer helpful?

 Print this Article

Also Read

[SQL3.03] How can I upload my MySQL database?

There are numerous ways to upload a MySQL database, we would strongly recommend trying methods 2...

[SQL3.06] What is MySQL?

MySQL is a Relational Database Management System. A relational database adds speed and...

[SQL3.11] What are valid connection strings on the Windows platform?

MySQL:Driver={MySQL ODBC 5.1 Driver};Server=localhost;Database=myDataBase;User=myUsername;...

[SQL3.13] What is the maximum MySQL database size permitted?

MySQL databases may take up to 500MB of space.

[SQL3.05] How do I connect to my MySQL database?

A simple php script to open a connection to a database<?php$dbhost = 'localhost';$dbuser = 'db...