ib_logfile和binary log file的区别

本文详细解析了MySQL binlog与ib_logfile的区别,包括它们的作用、查看方式及注意事项。通过对比,帮助读者深入理解这两种日志类型在数据库维护与恢复中的角色。

1.两者的区别:

 

The ib_logfile's hold statements affecting innodb tables only. If a crash occurs they are automatically used to complete any innodb transactions that didn't complete before the crash.


The bin logs record all statements that update data, regardless of engine. They are useful when you have to restore a backup and then roll forward to particular point in time and also to review what statements have been run.

iblogfile is temporary, only live till the data is updated into the tablespace, after which the space is reused.
binary log is more or a permanent and you have to purge the old logs yourself when it is not requried anymore.

 


 

2.如何查看两者的内容


使用下面的命令查看binlog里的内容
$ mysqlbinlog mysql-bin.<logfile-number>

注意:mysqlbinlog位于mysql的bin目录下,如果你的my.cnf的配置里面有:

[client]
default-character-set=utf8

执行时报unknown variable 'default-character-set=utf8'错误,这时可以改成:

[client]
loose-character-set = utf8

使用宽泛的设置,参见:http://blog.youkuaiyun.com/fafa211/article/details/2361066



使用下面的命令查看ib_logfile里的内容
$ strings ib_logfile<file-no.>

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值