SitePoint Sponsor

User Tag List

Results 1 to 5 of 5
  1. #1
    E-business guru Eirik's Avatar
    Join Date
    Nov 2000
    Location
    Oslo, Norway
    Posts
    413
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Moving MySQL database between hosts

    Hi,

    I'm appraching the move of a PHP&MySQL based site from one host to another and though I've moved several sites before, I've never had to move one where the content is constantly updated, meaning the MySQL database. So, I'm looking for pointers as to how to make the move as smooth as possible without loosing any data.

    A farily obvious thought that has crosse my mind is to have both sites using the db on the old host during the transition period, and then change to localhost on the new site once the DNS is completely up to date. Is this a guide idea, and if so, is this as easy as replacing 'localhost' in the mysql_connect() function with the IP address of the old/existing host?

    And if I were to go this way, how would I move the db content once the transition period is done without loosing any data that might be updated while I download and upload the .sql files?

    Thanks in advance!
    Sincerely,

    Eirik Johansen
    Netmaking AS

  2. #2
    SitePoint Guru dragonhawk's Avatar
    Join Date
    Apr 2002
    Location
    Melbourne
    Posts
    707
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I don't know if that is possible at all to move between sites without any downtime at all.

    I think you should advise of the transfer well in advance and set a date and time for the transfer to take place. The longest your site will be off is as long as it takes to propagate a domain.

    I've done this before on a site with database changes every 2 minutes... and your customers will know that upgrades are necessary and so they will not complain. Just make sure that they are notified of this though prior to your move.

  3. #3
    E-business guru Eirik's Avatar
    Join Date
    Nov 2000
    Location
    Oslo, Norway
    Posts
    413
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    But, regarding what I suggested; is that a good approach?

  4. #4
    SitePoint Guru dragonhawk's Avatar
    Join Date
    Apr 2002
    Location
    Melbourne
    Posts
    707
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Yes, I guess that is a good idea...

    And after readin gyour post carefully, it is just a matter of switching the IP address and localhost. But you need to make sure that you can access the database via the IP address.

    Check that the Host inside MySQL is a % and not localhost. You can ask your web host if you're unsure.

  5. #5
    E-business guru Eirik's Avatar
    Join Date
    Nov 2000
    Location
    Oslo, Norway
    Posts
    413
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    OK, thanks a lot dragonhawk!
    Sincerely,

    Eirik Johansen
    Netmaking AS


Bookmarks

Posting Permissions

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