重庆分公司,新征程启航
为企业提供网站建设、域名注册、服务器等服务
这篇文章将为大家详细讲解有关如何将MySQLDUMP全库备份分为单库文件,小编觉得挺实用的,因此分享给大家做个参考,希望大家阅读完这篇文章后可以有所收获。
成都创新互联专注于大悟企业网站建设,响应式网站建设,商城网站建设。大悟网站建设公司,为大悟等地区提供建站服务。全流程按需策划,专业设计,全程项目跟踪,成都创新互联专业和态度为您提供的服务
有时候我们备份是做的全库的备份,但是在恢复的时候却需要单库的文件,如果需要的库很小,我们把全库备份恢复回去然后导出想要的库的文件势必非常慢和耗时,这个时候如果
能够拆分文件为单库就好了,所以做了如下一个工具
工具叫做mysplit 可以查看备份出来每个库的大小和分割文件。
下载百度云盘:
http://pan.baidu.com/s/1mhfl6R2
下载后传入到LINUX系统
chmod 755 mysplit1.2
就可以用了帮助如下:
/*****************************************************
Copyright by GaoPeng .All rights reserved.Version 1.2
This tool is uesd to split more than one database dump
to split to single database file and show every datab
ase dump size.
USEAGE:./mysplit -show/-split dumpfilename [charset]
-show to show every database dump size
-split TO split every database to single file
[charset] is optional default /*SET NAMES UTF8*/
Editer's qq:22389860,bugs report!
*****************************************************/
使用实例分割库:
[root@hadoop1 ~]# mysplit1.2 -split log.log utf8
/*****************************************************
Copyright by GaoPeng .All rights reserved.Version 1.2
This tool is uesd to split more than one database dump
to split to single database file and show every datab
ase dump size.
USEAGE:./mysplit -show/-split dumpfilename [charset]
-show to show every database dump size
-split TO split every database to single file
[charset] is optional default /*SET NAMES UTF8*/
Editer's qq:22389860,bugs report!
*****************************************************/
NOTE:if use -show Enter y,follow hint is affect only -split
Will use charset utf8,please check !
Best way to find set names use Linux command:
head -n 10 dumpfilename
[y/n] y:use default charset utf8/n:exit mysplit
y
/*!40101 SET NAMES utf8 */;
number 1,begin 778,end 908,database --g1'size= 0.126953(KB)
new file is create of databse g1
number 2,begin 909,end 1045,database --kkmm'size= 0.132812(KB)
new file is create of databse kkmm
number 3,begin 1046,end 627860,database --mysql'size= 612.123047(KB)
new file is create of databse mysql
number 4,begin 627861,end 628477,database --nvc'size= 0.601562(KB)
new file is create of databse nvc
number 5,begin 628478,end 251621886,database --test'size= 245110.750000(KB)
new file is create of databse test
number 6,begin 251621887,end 251622887,database --test1'size= 0.976562(KB)
new file is create of databse test1
number 7,begin 251622888,end 262508330,database --test100'size= 10630.314453(KB)
new file is create of databse test100
number 8,begin 262508331,end 262992362,database --test2'size= 472.686523(KB)
new file is create of databse test2
number 9,begin 262992363,end 262992505,database --testl2'size= 0.138672(KB)
new file is create of databse testl2
number 10,begin 262992506,end 262992549,database --g1'size= 0.041992(KB)
file is exist append to databse g1
number 11,begin 262992550,end 262992597,database --kkmm'size= 0.045898(KB)
file is exist append to databse kkmm
number 12,begin 262992598,end 262992647,database --mysql'size= 0.047852(KB)
file is exist append to databse mysql
number 13,begin 262992648,end 262992693,database --nvc'size= 0.043945(KB)
file is exist append to databse nvc
number 14,begin 262992694,end 262993646,database --test'size= 0.929688(KB)
file is exist append to databse test
number 15,begin 262993647,end 262994567,database --test1'size= 0.898438(KB)
file is exist append to databse test1
number 16,begin 262994568,end 262995526,database --test100'size= 0.935547(KB)
file is exist append to databse test100
number 17,begin 262995527,end 262995576,database --test2'size= 0.047852(KB)
file is exist append to databse test2
number 18,begin 262995577,end 262996054,database --testl2'size= 0.465820(KB)
file is exist append to databse testl2
UESD TIME TOTAL:
35.000000 seconds used
查看每个库备份出来的大小:
[root@hadoop1 ~]# mysplit1.2 -show log.log utf8
/*****************************************************
Copyright by GaoPeng .All rights reserved.Version 1.2
This tool is uesd to split more than one database dump
to split to single database file and show every datab
ase dump size.
USEAGE:./mysplit -show/-split dumpfilename [charset]
-show to show every database dump size
-split TO split every database to single file
[charset] is optional default /*SET NAMES UTF8*/
Editer's qq:22389860,bugs report!
*****************************************************/
NOTE:if use -show Enter y,follow hint is affect only -split
Will use charset utf8,please check !
Best way to find set names use Linux command:
head -n 10 dumpfilename
[y/n] y:use default charset utf8/n:exit mysplit
y
/*!40101 SET NAMES utf8 */;number 1,begin 778,end 908,database --g1'size= 0.126953(KB)
number 2,begin 909,end 1045,database --kkmm'size= 0.132812(KB)
number 3,begin 1046,end 627860,database --mysql'size= 612.123047(KB)
number 4,begin 627861,end 628477,database --nvc'size= 0.601562(KB)
number 5,begin 628478,end 251621886,database --test'size= 245110.750000(KB)
number 6,begin 251621887,end 251622887,database --test1'size= 0.976562(KB)
number 7,begin 251622888,end 262508330,database --test100'size= 10630.314453(KB)
number 8,begin 262508331,end 262992362,database --test2'size= 472.686523(KB)
number 9,begin 262992363,end 262992505,database --testl2'size= 0.138672(KB)
number 10,begin 262992506,end 262992549,database --g1'size= 0.041992(KB)
number 11,begin 262992550,end 262992597,database --kkmm'size= 0.045898(KB)
number 12,begin 262992598,end 262992647,database --mysql'size= 0.047852(KB)
number 13,begin 262992648,end 262992693,database --nvc'size= 0.043945(KB)
number 14,begin 262992694,end 262993646,database --test'size= 0.929688(KB)
number 15,begin 262993647,end 262994567,database --test1'size= 0.898438(KB)
number 16,begin 262994568,end 262995526,database --test100'size= 0.935547(KB)
number 17,begin 262995527,end 262995576,database --test2'size= 0.047852(KB)
number 18,begin 262995577,end 262996054,database --testl2'size= 0.465820(KB)
UESD TIME TOTAL:
11.000000 seconds used
如此我们可以使用分割的文件进行导入!
关于“如何将MYSQLDUMP全库备份分为单库文件”这篇文章就分享到这里了,希望以上内容可以对大家有一定的帮助,使各位可以学到更多知识,如果觉得文章不错,请把它分享出去让更多的人看到。