Move Multi DB Setup on the same server

Monthly
  • 1162 points
    Like some sort of WPMU DEV God"
    Mindblowingly helpful member
    Lifetime member
    Mark de Scande

    Member par excellence  —  18th January 2012 (4 months ago)         

    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

    SSH
    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