Web Analytics Made Easy -
StatCounter Accessing MySQL remotely - CodingForum

Announcement

Collapse
No announcement yet.

Accessing MySQL remotely

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

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

    Comment


    • #3
      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...).
      Be yourself. No one else is as qualified.

      Comment


      • #4
        LOL! bdl isn't as long winded as I am. No wonder he beat me by a full minute!

        <grin/>
        Be yourself. No one else is as qualified.

        Comment


        • #5
          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)

          Comment


          • #6
            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...

            Comment


            • #7
              Originally posted by Uzair View Post
              My Apology if I typed "Urgent".
              No need to apologize, the problem is mine, not yours.


              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?

              Comment


              • #8
                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""[email protected]"); // email on which order details should be sent when order is placed
                    
                define("CONTACTUS_EMAIL""[email protected]");
                    
                    
                //echo $_SERVER['REQUEST_URI'];

                ?>
                Last edited by Uzair; Apr 14, 2009, 03:55 AM.

                Comment


                • #9
                  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.

                  Comment

                  Working...
                  X