Jump to content

define another database?


MSUK1

Recommended Posts

If you are trying to connect to an external database, permissions must be set on that database to allow access.  For example, with MySQL, you could need to grant access:

 

GRANT ALL PRIVILEGES ON db_name.* TO username@'IP_ADDRESS_HERE' IDENTIFIED BY 'password_here';

 

Then you create a new database connection using the above information.

 

EDIT: Forgot to mention if they are not using the default MySQL port you will need to define that as well.

what IP address is that exactly, lets say we have

 

SERVER 1 & SERVER 2

 

server 1 holds the data

server 2 connects to server 1 for the data

 

so whose who in that situation?

 

sorry this part really baffles me, using localhost and keeping it all internal, no problem for me, but its vital that we get an external connection :/

 

thankyou"

i have cpanel so i edited the remotesql  and added SERVER2

 

and in the php script i have this...

<?php
$host="174.37.172.25"; // Host name 
$username="db_System"; // Mysql username 
$password="password"; // Mysql password 
$db_name="table_StaceyOfficialLoginSystem"; // Database name 
$tbl_name="guestbook"; // Table name

// Connect to server and select database.
mysql_connect("$host", "$username", "$password")or die("cannot connect server "); 
mysql_select_db("$db_name")or die("cannot select DB");

$sql="SELECT * FROM $tbl_name ORDER BY id DESC LIMIT 1;";
$result=mysql_query($sql);

while($rows=mysql_fetch_array($result)){
?>

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.