...

View Full Version : Accessing MySQL remotely



Uzair
04-14-2009, 08:29 AM
Hi Experts,

I have 2 hosting accounts, 1 with BlueHost & 1 with HostMonster.

I have a website running on BlueHost server but I wanna keep the Database on HostMonster Server. Someone please guide me step by step that how can I access the database remotly.

Its really urgent, please help...

Thanks.

bdl
04-14-2009, 08:33 AM
It's not "urgent". Needing help after you've wrapped your car around a tree is urgent. This is a MySQL question.

You'll have to ask your host. Most hosting companies (if they're smart) will disallow any connections from servers other than their own.

Old Pedant
04-14-2009, 08:34 AM
You may or may not be able to. The web host can restrict which clients can "see" a given database, so they might not allow remote access. You will have to ask HostMonster if they allow it.

If they do allow remote access, it's just a matter of getting the right connection string. Probably will just use the IP address of the remote server and then supply the proper credentials. But exactly what the code (and connection) looks like will depend on what client you are using to hit the DB with (that is, PHP or JSP or...).

Old Pedant
04-14-2009, 08:35 AM
LOL! bdl isn't as long winded as I am. No wonder he beat me by a full minute!

<grin/>

bdl
04-14-2009, 08:43 AM
LOL! bdl isn't as long winded as I am. No wonder he beat me by a full minute!

Yes, but your answer is better and doesn't include a smartass comment. (It's just that "urgent" questions happen to be a pet peeve of mine)

Uzair
04-14-2009, 08:49 AM
My Apology if I typed "Urgent".

But this is because I tried my best to connect to the DB remotely but could't succeed.

Both hosting accounts have shared IP address. Is this the problem?
I have asked HostMonster about this issue & they said that they allow remote access. I also entered the IP address of BlueHost account in my HostMonster white list & also given that IP address in "Remote MySQL" section of my cPanel but no use :(

Please please please people.... help me...

bdl
04-14-2009, 09:08 AM
My Apology if I typed "Urgent".
No need to apologize, the problem is mine, not yours. :)




Both hosting accounts have shared IP address. Is this the problem?
I have asked HostMonster about this issue & they said that they allow remote access. I also entered the IP address of BlueHost account in my HostMonster white list & also given that IP address in "Remote MySQL" section of my cPanel but no use :(

Having a shared IP shouldn't be an issue.

How are you attempting to connect? Is there an error message returned?

Uzair
04-14-2009, 09:47 AM
Try accessing " http://www.walkingmovies.com ". Its just showing "Invalid Login".

My Config file contains these settings...



<?
session_start();
function conn2db()
{
if ((@$db=mysql_pconnect("74.220.215.52:3306", "uzairusm_user", "password")) == FALSE)
{
echo mysql_error();
}
if(!mysql_select_db("uzairusm_videos", $db))
{
echo mysql_error();
}
return $db;
}
conn2db();
error_reporting(E_ERROR);
define("SITE_TITLE", "Walking Movies");
define("RECORDS_PER_PAGE", 10);
define("NUMBERS_IN_PAGING",10);// how pages should be shown in paging bar
define("SITE_URL","http://www.walkingmovies.com/");
define("ORDER_EMAIL", "sales@walkingmovies.com"); // email on which order details should be sent when order is placed
define("CONTACTUS_EMAIL", "sinfo@walkingmovies.com");

//echo $_SERVER['REQUEST_URI'];

?>

bdl
04-14-2009, 03:40 PM
Ok, well "invalid login" sounds like an artificial error produced by the PHP code. What you need to do is either use the 'mysql' command line client to connect to the remote server, e.g.
mysql -u your_username -p -C -h remote_host_ip_address_or_hostname.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum