Home > Database > Mysql Tutorial > Linux下的MySQL数据库单独打包脚本

Linux下的MySQL数据库单独打包脚本

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-06-07 16:54:33
Original
896 people have browsed it

这个Linux下的MySQL数据库单独打包脚本共有三个功能:1.建立以日期为名称的文件夹,用于存放mysql数据库备份2.以日期为名称的文件夹

这个Linux下的MySQL数据库单独打包脚本共有三个功能:
1.建立以日期为名称的文件夹,用于存放mysql数据库备份
2.以日期为名称的文件夹如果超过30未更新,则自动删除,以节省服务器空间
3.进入/var/lib/mysql目录,对目录下的所有数据库目录进行单独打包
从事行业不同,仅供参考!如有不足之处,请大家及时指正!
#!/usr/bin/perl
chdir "/backup";
$file = "mysql_backup";
if (! -e $file)
{
system "mkdir $file";
}
chdir $file;
$x=`date +%Y%m%d`;
if (! -e $x)
{
system "mkdir $x";
}
@b = ;
foreach $b(@b)
{
if (-M $b > 30)
{
system "rm -rf $b";
}
}
chdir "/var/lib/mysql";
@a = ;
foreach (@a)
{
if ( -d )
{
system "tar czvf /backup/$file/`date +%Y%m%d`/$_.tar.gz $_";
}
}

linux

Related labels:
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Issues
MySQL stops process
From 1970-01-01 08:00:00
0
0
0
Error when installing mysql on linux
From 1970-01-01 08:00:00
0
0
0
phpstudy cannot start mysql?
From 1970-01-01 08:00:00
0
0
0
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template