Move Multi DB Setup on the same server

Hey guys

I have been moving DB around on my server to my back up drive it worked fine for standard WordPress site and the db moved fine no problem

Here is how i have done it and it worked for single db not the multi db setup


1) make a tar file of the DB

cd /var/lib/mysql

tar -zcvf blogline_db1234.tar.gz blogline_db1234

2) make a dir for the new DB

mkdir /backupdrive/mysql/

chmod -R 751 /backupdrive/mysql/

chown -R mysql:mysql /backupdrive/mysql/

3) Now Copy the tar file over to your new /backupdrive/mysql/

cd /var/lib/mysql

cp -Rf blogline_db1234.tar.gz /backupdrive/mysql/

4) Now untar the file

cd /backupdrive/mysql/

tar -zxvf blogline_db1234.tar.gz

5) Make sure the files are in the backupdrive/mysql/

cd /backupdrive/mysql/

du -sh — *

6) Rename Old DB

Just SFTP and then go to /var/lib/mysql/ look for the DB and rename it to 1blogline_db1234

7) SimmLink (This tells My SQL the DB has moved)

ln -s /backupdrive/mysql/blogline_db1234/ /var/lib/mysql/blogline_db1234

8) Set Permissions

chmod -R 751 /var/lib/mysql/blogline_db1234

chown -R mysql:mysql /var/lib/mysql/blogline_db1234

9) Now log in to your WordPress site and make sure it is still working just draft a post if it dont save then reset permissions if this dont work log in to Cpanel and do a repair on the DB some times you have to do this 3 times to get the site working again

10) Remove old DB

rm -rf /var/lib/mysql/blogline_db1234

11) Also remove the tar file in /backupdrive/mysql/blogline_db1234.tar.gz

rm -rf /backupdrive/mysql/blogline_db1234.tar.gz

Now this set up works for moving WordPress but it dont work for Multi DB any ideas and toughts would be welcom

  • Mark de Scande
    • Syntax Hero

    @phil Just a update from Soft Layer

    Employee Response – 2012-Jan-18 17:24 (GMT+0200) [Update 6]

    According to WordPress: (due to the SOPA protests you may need to scroll to the bottom of the page and click “Continue to”:wink: this can still be done, but will require modifying the databases themselves to reference the new location(s) on the server. As such, before making any attempts to move the databases you would want to create backups of them. It may honestly be easier/better to only move the single DB sites and leave the multi DB sites in-tact.

    Please let me know if you have any questions.

    Thank you for choosing Softlayer,

    William B

    Customer Technical Support

  • Mark de Scande
    • Syntax Hero

    @phil After a lot of reading up on DBs it looks like the way MultiDB works it has ref to the location of the dbs on the server so i was given a idea by the server admin at Softlayer

    Again this is only a idea i have not tested it so i wont know if it will work

    Employee Response – 2012-Jan-18 18:45 (GMT+0200) [Update 8]

    While you cannot actually increase the size of /var you can move the contents of the directory elsewhere and then create a sybolic link from the new location to /var/lib/mysql/. This will cause mysql to follow the link to the new directory; This can be anywhere you like including a second drive!

    For example:

    mv -v /var/lib/mysql/* /some/new/directory/

    ln -s /some/new/directory/ /var/lib/mysql/

    As with anything else you will want to ensure you have backups of the databases before you move them.

    This will require that _everything_ is moved out of /var/lib/mysql.

    I can say i did this on my last server moving the hole /var/lib/mysql to a lets call it a back up drive and then just added the sim link in the /var/lib/mysql and it did work on the old server so i think SoftLayers idea will work on the new server, The only problem is to move the hole dir over to a new drive will have a lot of customers unhappy as the server will be down for a wile :slight_frown:

    Again i am just posting my findings here so i can help any one else out there

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.