PDA

View Full Version : MYSQL host



zerocool786
June 16th, 2006, 08:49
Hi

Lets say:
I have server A that does not support MYSQL or CGI only PHP. But Server B that supports MYSQL and Cgi?

Question: How can I make my serve A use MYSQL from Server B. Can I link togther.

ingfina
June 16th, 2006, 10:23
You have to ask host B if they permit external connections to Mysql.

monaghan
June 16th, 2006, 10:52
You also want the servers to be in the same LAN otherwise you're likely to get significiant lags if you have to do lookups / transfer large result sets over the network

monaghan
June 16th, 2006, 10:55
Just another thought, if host A doesn't support MySQL, then they may have PHP compiled without any MySQL or ODBC support, this would cause you big problems :)

Tree
June 16th, 2006, 12:22
True. You need to go to server B's cPanel and allow remote access hosts. You can put in "%" for all or Server A's IP. Either will work.

There's a setting in php.ini that might not allow external connections, so it may not work if that is disabled.

zerocool786
June 18th, 2006, 17:26
Thanks for al ur help.

So Server B does supports external.
How should my code look like. If server B is http://www.mydomain.com
$dbhost = "localhost";
$dbuname = "XXXXXX";
$dbpass = "XXXXXX";
$dbname = "XXXXXX";
$prefix = "nuke";

zerocool786
June 18th, 2006, 21:09
I found this article on the net.

http://www.15seconds.com/issue/050210.htm



Would this help me with my question?

Robert
June 18th, 2006, 21:22
If Server B supports access to a MySQL Database on their server from an external source, you would connect to it by the IP plus port, so if the IP of the host was 1.1.1.1, you'd connect to 1.1.1.1:3306.

Your code would look like this:

$dbhost = "1.1.1.1:3306";
$dbuname = "XXXXXX";
$dbpass = "XXXXXX";
$dbname = "XXXXXX";
$prefix = "nuke";

zerocool786
June 19th, 2006, 09:50
How would I find the IP of the host and Port number

Is there a script I can use to find

Host World Web
June 19th, 2006, 10:28
<?PHP
phpinfo();
?>

zerocool786
June 19th, 2006, 12:02
Thanks for the code

Where should I look for the Host IP and Port, because there are so many;

SERVER["SERVER_ADDR"]
_SERVER["SERVER_ADMIN"]
_SERVER["SERVER_NAME"]
_SERVER["SERVER_PORT"]


or

_SERVER["REMOTE_ADDR"] XXXXXXXXXXXXX
_SERVER["REMOTE_PORT"]

REMOTE_ADDR
REMOTE_PORT

thanks for ur help

Host World Web
June 19th, 2006, 12:17
Server_addr

zerocool786
June 19th, 2006, 14:37
http://pakispace.110mb.com/ip.php

So my code should look like this

$dbhost = ""208.101.44.240:80"";
$dbuname = "XXXXXX";
$dbpass = "XXXXXX";
$dbname = "XXXXXX";
$prefix = "nuke";

Host World Web
June 19th, 2006, 14:57
http://pakispace.110mb.com/ip.php

So my code should look like this

$dbhost = ""208.101.44.240:80"";
$dbuname = "XXXXXX";
$dbpass = "XXXXXX";
$dbname = "XXXXXX";
$prefix = "nuke";


You need to look at the code... You have two double quotes arount the IP address. Also I do not think you need the port 80 as it should default to that anyways. You can also use the domain name of the other sever instead of the IP address. EX: $dbhost = "doamin.com";

$dbhost = "208.101.44.240";
$dbuname = "XXXXXX";
$dbpass = "XXXXXX";
$dbname = "XXXXXX";
$prefix = "nuke";

Robert
June 19th, 2006, 18:03
http://pakispace.110mb.com/ip.php

So my code should look like this

$dbhost = ""208.101.44.240:80"";
$dbuname = "XXXXXX";
$dbpass = "XXXXXX";
$dbname = "XXXXXX";
$prefix = "nuke";

No. MySQL runs on port 3306, so it would be 208.101.44.240:3306

zerocool786
June 19th, 2006, 19:37
Where did you get 3306? I can see on the ip.php

zerocool786
June 19th, 2006, 20:59
I hear that 110mb.com do not support external access to MYSQL.

But on http://pakispace.110mb.com/ip.php page

Under MYSQL menu, it says MYSQL_MODULE_TYPE external


isn't that the same thing

ingfina
June 19th, 2006, 21:52
Where did you get 3306? I can see on the ip.php
Default Mysql port.

zerocool786
June 20th, 2006, 09:51
How DO I find it if 110mb.com support external access to SQL with a script. I know Ic anask them, but its going to take some time.

Is there a script?

monaghan
June 20th, 2006, 12:20
The best option is to ask your host directly, just because you can access now doesn't mean you'll be able to access tomorrow.

Robert
June 20th, 2006, 18:41
The easiest way to see if they support external access is to use a script like this:



<?php
$username = "pee_wee";
$password = "let_me_in";
$hostname = "localhost";
$dbh = mysql_connect($hostname, $username, $password)
or die("Unable to connect to MySQL");
print "Connected to MySQL<br>";
mysql_close($dbh);
?>


And change the info to match the ost and run it from another website and see if you can connect or not.