Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 9 of 9
  1. #1
    Regular Coder
    Join Date
    Aug 2005
    Posts
    365
    Thanks
    7
    Thanked 1 Time in 1 Post

    Question Accessing MySQL remotely

    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.

  • #2
    bdl
    bdl is offline
    Regular Coder
    Join Date
    Apr 2007
    Location
    Camarillo, CA US
    Posts
    590
    Thanks
    4
    Thanked 83 Times in 82 Posts
    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.

  • #3
    Supreme Master coder! Old Pedant's Avatar
    Join Date
    Feb 2009
    Posts
    25,519
    Thanks
    77
    Thanked 4,381 Times in 4,346 Posts
    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...).

  • #4
    Supreme Master coder! Old Pedant's Avatar
    Join Date
    Feb 2009
    Posts
    25,519
    Thanks
    77
    Thanked 4,381 Times in 4,346 Posts
    LOL! bdl isn't as long winded as I am. No wonder he beat me by a full minute!

    <grin/>

  • #5
    bdl
    bdl is offline
    Regular Coder
    Join Date
    Apr 2007
    Location
    Camarillo, CA US
    Posts
    590
    Thanks
    4
    Thanked 83 Times in 82 Posts
    Quote Originally Posted by Old Pedant View Post
    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)

  • #6
    Regular Coder
    Join Date
    Aug 2005
    Posts
    365
    Thanks
    7
    Thanked 1 Time in 1 Post

    Question

    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...

  • #7
    bdl
    bdl is offline
    Regular Coder
    Join Date
    Apr 2007
    Location
    Camarillo, CA US
    Posts
    590
    Thanks
    4
    Thanked 83 Times in 82 Posts
    Quote Originally Posted by Uzair View Post
    My Apology if I typed "Urgent".
    No need to apologize, the problem is mine, not yours.


    Quote Originally Posted by Uzair View Post
    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?

  • #8
    Regular Coder
    Join Date
    Aug 2005
    Posts
    365
    Thanks
    7
    Thanked 1 Time in 1 Post
    Try accessing " http://www.walkingmovies.com ". Its just showing "Invalid Login".

    My Config file contains these settings...

    PHP Code:
    <?
        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'];

    ?>
    Last edited by Uzair; 04-14-2009 at 08:55 AM.

  • #9
    bdl
    bdl is offline
    Regular Coder
    Join Date
    Apr 2007
    Location
    Camarillo, CA US
    Posts
    590
    Thanks
    4
    Thanked 83 Times in 82 Posts
    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.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •