Learn about Centmin Mod LEMP Stack today
Become a Member

MariaDB Migrating site db, the fastest way?

Discussion in 'Nginx, PHP-FPM & MariaDB MySQL' started by rdan, Jun 1, 2014.

Tags:
  1. rdan

    rdan Well-Known Member

    5,439
    1,398
    113
    May 25, 2014
    Ratings:
    +2,187
    Local Time:
    11:43 PM
    Mainline
    10.2
    I think this is the fastest way:
    Code:
    rsync /var/lib/mysql
    Do you recommend it? :)
    Does have dis advantages?

     
  2. eva2000

    eva2000 Administrator Staff Member

    53,558
    12,135
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +18,678
    Local Time:
    1:43 AM
    Nginx 1.27.x
    MariaDB 10.x/11.4+
    nooooooooo do not do that especially with InnoDB tables, you can end up breaking stuff ! Only time you'd do that is if you have MySQL server on both source and destination servers shutdown and the destination server is a virgin fresh /var/lib/mysql setup that hasn't been used yet. The order and process is delicate e.g. you don't want your MySQL tables being written to while doing such a file transfer.

    Safest way is to mysqldump to sql file and rsync the file and reimport into new server. Difference in time between safest vs fastest isn't that much different if you do it right the first time (and if source and destination servers are on the same local web host network)

    InnoDB files can not be moved the same way like MyISAM files or you will end up corrupting MySQL InnoDB tables if you are not careful.
     
  3. rdan

    rdan Well-Known Member

    5,439
    1,398
    113
    May 25, 2014
    Ratings:
    +2,187
    Local Time:
    11:43 PM
    Mainline
    10.2
    Thanks for the heads up :)