Mysqlhotcopy热备本工具介绍
原创
©著作权归作者所有:来自51CTO博客作者key001的原创作品,请联系作者获取转载授权,否则将追究法律责任
官方介绍
mysqlhotcopy is a Perl script that was originally
written and contributed by Tim Bunce. It uses FLUSH TABLES, LOCK TABLES,
and cp or scp to make a database backup. It is a fast way to make a backup of
the database or single tables, but it can be run only on the same machine where
the database directories are located. mysqlhotcopy works only for backing up MyISAM and ARCHIVE tables. It runs on Unix and
NetWare.
To use mysqlhotcopy,
you must have read access to the files for the tables that you are backing up,
theSELECT privilege for those tables, the RELOAD privilege (to be able to execute FLUSH TABLES),
and theLOCK TABLES privilege (to be able to lock the
tables).
Mysqlhotcopy适用于小型数据库,适用flush tables,locktables,cp(scp)备份数据库
shell#mysqlhotcopy
-u 用户 备份数据库名称 目标文件夹
执行报错:
install_driver(mysql)
failed: Can't locate DBD/mysql.pm in @INC (@INC contains: /usr/local/lib/perl5
/usr/local/share/perl5 /usr/lib/perl5/vendor_perl /usr/share/perl5/vendor_perl
/usr/lib/perl5 /usr/share/perl5 .) at (eval 12) line 3.
Perhaps the DBD::mysql
perl module hasn't been fully installed,
or perhaps the
capitalisation of 'mysql' isn't right.
Available drivers:
DBM, ExampleP, File, Gofer, Proxy, SQLite, Sponge.
at /usr/local/mysql/bin/mysqlhotcopy line 178
原因:缺少perl连接数据库驱动
解决办法:
安装 perl-DBD-MySQL和perl-DBI
关于DBD和DBI介绍
DBI is a
database-independent interface for the Perl programming language. DBD::mysql is
the driver for connecting to MySQL database servers with DBI.
·
DBI is
the basic abstraction layer for working with databases in Perl.
·
DBD::mysql is
the driver for using MySQL with DBI.
·
Net::MySQL is
a pure-Perl implementation of the MySQL client-server protocol. (It is not
necessary when using DBI with DBD::mysql, but may be useful in environments
where you are not able to compile the MySQL client library required by
DBD::mysql.)
接下来执行备份还是报错,
Invalid db.table
name 'mysql.mysql`.`columns_priv' at /usr/local/mysql/bin/mysqlhotcopy line
854.
在网上查了下是mysqlhotcopy脚本的bug
解决办法
在my
@dbh_tables = eval { $dbh->tables() };(应该是834行)这行下面添加
map { s/^.*?\.//o }
@dbh_tables;
提问和评论都可以,用心的回复会被更多人看到
评论
发布评论
相关文章
-
DG_broker工具管理切换DG主备
DG_broker工具管理切换DG主备
oracle TCP hive -
Exchange邮件批量删除工具1.0版本
exchange批量删除邮件
Outlook 快速查找 邮件系统 -
MySQL备份工具选择角度:冷备 温备 热备MySQL