mysql database 資料遷移:mydumper與myloader
阿新 • • 發佈:2018-11-23
[[email protected] ~]# yum install glib2-devel mysql-devel zlib-devel pcre-devel openssl-devel cmake [[email protected] ~]# tar zxvf mydumper-0.9.1.tar.gz [[email protected] ~]# cd mydumper-0.9.1 [[email protected]mydumper-0.9.1]# cmake . [[email protected] mydumper-0.9.1]# make [[email protected] mydumper-0.9.1]# make install mydumper -u [USER] -p [PASSWORD] -h [HOST] -P [PORT] -t [THREADS] -b -c -B [DB] -o [directory] -B, --database:需要備份的庫 -T, --tables-list:需要備份的表,多表,用逗號分隔 -c, --compress:壓縮輸出檔案 -o, --outputdir:輸出檔案的目錄 -m, --no-schemas:不匯出表結構 -t, --threads:使用的執行緒數,預設4 -v, --verbose:更多輸出, 0 = silent, 1 = errors, 2 = warnings, 3 = info, default 2 備份所有資料庫:除了information_schema與performance_schema之外的庫都會被備份 mydumper -u root -p abcd.1234 -o /home/mysql/backup 備份單個庫 mydumper -u root -p abcd.1234 -B tpcc1000 -o /home/mysql/backup 備份單表 mydumper -u root -p abcd.1234 -B tpcc1000 -T customer -o /home/mysql/backup 備份多表 mydumper -u root -p abcd.1234 -B tpcc1000 -T customer,orders -o /home/mysql/backup 只備份表資料不備份表結構 mydumper -u root -p abcd.1234 -B tpcc1000 -T customer -m -o /home/mysql/backup 壓縮備份 mydumper -u root -p abcd.1234 -B tpcc1000 -T customer -c -o /home/mysql/backup