原文:http://www.madden2009.cn/?p=520 1、需要PERL-DBD模块的支持,检查有没有安装该模块。 在我的机子上的显示有安装: [root@localhost data]# rpm -qa |grep perl-DBD | grep MySQL perl-DBD-MySQL-3.0007-1.fc6
2、到mysql的数据库段分配一个专门用于备份的用户,密码为123456. mysql> grant select,reload,lock tables on *.* to ‘hotcopyer’@‘localhost’ identified by ‘123456′; Query OK, 0 rows affected (0.00 sec)
mysql> flush privileges; Query OK, 0 rows affected (0.00 sec)
3、在/etc/my.cnf或者登陆用户的个人home目录下的my.cnf里面添加下面内容: [mysqlhotcopy] interactive-timeout user=hotcopyer password=123456 port=3306
4、开始MYSQLHOTCOPY备份数据。 [root@localhost ~]# mysqlhotcopy t_girl t_girl_new
Locked 4 tables in 0 seconds. Flushed tables (`t_girl`.`category`, `t_girl`.`category_part`, `t_girl`.`id`, `t_girl`.`parent`) in 0 seconds. Copying 22 files... Copying indices for 0 files... Unlocked tables. mysqlhotcopy copied 4 tables (22 files) in 5 seconds (5 seconds overall).
查看备份后的目录: [root@localhost data]# du -h | grep t_girl
213M ./t_girl 213M ./t_girl_copy [root@localhost ~]# |