Home » Categories » Multiple Categories

How do I use PHP to connect to another database on another server?

When you make a connection to a database, you use the usual statement:

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

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

If you need to connect to a database that is on another server, you would replace localhost with the IP address of the server.

You can find the IP address of the database’s server by checking your eXtend Control Panel.

  1. Log into your eXtend Control Panel
  2. Click on ‘MySQL Databases’
  3. Scroll down to the existing databases
  4. Copy the IP address next to the database you require
  5. Paste that IP address into your mysql_connect line
1 (1)
Article Rating (1 Votes)
Rate this article
  • Icon PDFExport to PDF
Related Articles
How do I back up my MySQL database?
Added on Thu, Feb 26, 2015
Can I rename my database getting rid of the ’web-’ part of the name?
Added on Mon, Mar 2, 2015
What is Python?
Added on Fri, Mar 13, 2015
Why am I getting a host blocked with mysqladmin flush-hosts error?
Added on Mon, Mar 2, 2015
What is Perl and what can it do?
Added on Fri, Mar 13, 2015