专注各种脚本编程
Baidu
加入收藏夹
本站内容有下面分类知识,欢迎您的到来^_^
shell相关:指令篇 基础篇 脚本欣赏 编程实例 shell问问 shell视频教程 技巧篇 水平测试 E文资料 vi编辑器 高级Bash脚本编程指南
其他:mysql perl c语言 oracle
当前位置:| 主页>mysql>

用mysqlhotcopy备份数据的步骤

百度收藏 QQ搜藏

原文: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 ~]#

上一篇:重写mysql客户端提示符 下一篇:mysqlhotcopy热备工具使用总结

power by soyo123 2007-2008