how can we connect 2 a remote mySQL Database

Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.

Moderator: General Moderators

Post Reply
saadatshah
Forum Newbie
Posts: 23
Joined: Fri Jul 05, 2002 5:50 am
Location: Lahore

how can we connect 2 a remote mySQL Database

Post by saadatshah »

Hi All,
i need 2 connect with a remote mySQL database......can any1 help me doin this....


advance thx 2 all

----------
Saadi
----------
User avatar
twigletmac
Her Royal Site Adminness
Posts: 5371
Joined: Tue Apr 23, 2002 2:21 am
Location: Essex, UK

Post by twigletmac »

The same way that you connect to a local one using mysql_connect() except the host name will be something other than localhost, it will be the name of the remote mysql server (or its IP address).

To connect to a remote server, your IP address or domain has to be given the right to connect under your username and password.

Mac
User avatar
Takuma
Forum Regular
Posts: 931
Joined: Sun Aug 04, 2002 10:24 am
Location: UK
Contact:

Post by Takuma »

So like this:-

Code: Select all

<?php
mysql_connect("www.remotehost.com","root","123");
?>
Post Reply