[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.11] What are valid connection strings on the Windows platform?

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

[SQL3.01] How do I backup my MySQL database?

Backing up your MySQL database can be done in several ways1. Using the backup tool from the Web...

[SQL3.07] How do I create a MySQL database?

If your account type includes MySQL databases, then log in to your Hosting cPanel v7.5 Control...

[SQL3.02] How can I manage my MySQL database?

Once you have created a database using your Hosting cPanel v7.5 Control Panel you will be able to...