binlog 报unknown variable 'default-character-set=utf8'

方法1: 在/etc/my.cnf 中将default-character-set=utf8修改成charater-set-server=utf8
方法2:

mysqlbinlog --no-defaults mysql-bin.000001

SHOW SLAVE STATUS:

1) The position, ON THE MASTER, from which the I/O thread is reading: Master_Log_File/Read_Master_Log_Pos. —–相对于主库,从库读取主库的二进制日志的位置,是IO线程

2) The position, IN THE RELAY LOGS, at which the SQL thread is executing: Relay_Log_File/Relay_Log_Pos —-相对于从库,是从库的sql线程执行到的位置

3) The position, ON THE MASTER, at which the SQL thread is executing:Relay_Master_Log_File/Exec_Master_Log_Pos —-相对于主库,是从库的sql线程执行到的位置

读懂binlog日志:
binlog-format=ROW模式下:

1、提取sakila库的binlog日志
mysqlbinlog -d sakila --base64-output=decode-rows -v binlog.000008 >/tmp/test.sql

2、提取sakila库下actor表的binlog日志
mysqlbinlog -d sakila --base64-output=decode-rows -v binlog.000008|grep actor

mysqlbinlog -d sakila --base64-output=decode-rows -v mysql-bin.000008|grep -C 10 actor> /tmp/actor.txt

###grep -A -B -C 后面都跟阿拉伯数字

-A是显示匹配后和它后面的n行。 
-B是显示匹配行和它前面的n行。 
-C是匹配行和它前后各n行。 
-C覆盖面最大,这3个开关都是关于匹配行的上下文的(context

###

筛选UPDATE

cat /tmp/actor.txt |grep -C 10 UPDATE > /tmp/actor_update.txt

3、提取sakila库下INSERT操作的binlog日志
mysqlbinlog -d sakila --base64-output=decode-rows -v binlog.000008|grep insert

4、提取指定时间段的binlog日志
mysqlbinlog --base64-output=decode-rows -v --start-datetime='2016-01-04 15:10:00' --stop-datetime='2016-01-04 15:11:00' binlog.000008 >/tmp/test.sql
提取指定position位置的binlog日志
mysqlbinlog --base64-output=decode-rows -v --start-position='398' --stop-position='617' binlog.000008 >/tmp/test.sql

5、提取指定position位置的binlog日志并输出到压缩文件
mysqlbinlog --start-position="6088" --stop-position="9832" binlog.000008 |gzip >test.sql.gz

6、提取指定position位置的binlog日志导入数据库
mysqlbinlog --start-position="120" --stop-position="332" binlog.000008 | mysql -uroot -p

7、提取指定开始时间的binlog并输出到日志文件
mysqlbinlog --start-datetime="2018-12-15 20:15:23" binlog.000008 --result-file=test.sql

8、提取指定位置的多个binlog日志文件
mysqlbinlog --start-position="120" --stop-position="332" binlog.000008 binlog.000008|more

9、提取指定数据库binlog并转换字符集到UTF8
mysqlbinlog --database=test --set-charset=utf8 binlog.000008 binlog.000008 >test.sql

10、远程提取日志,指定结束时间
mysqlbinlog -uroot -p -h10.168.10.11 -P3306 --stop-datetime="2014-12-15 20:30:23" --read-from-remote-server mysql-bin.000033 |more

11、远程提取使用row格式的binlog日志并输出到本地文件
mysqlbinlog -uroot -p -P3606 -h10.168.10.11 --read-from-remote-server -vv binlog.000008 >test.sql

最新文章

  1. 版本管理工具SVN
  2. java http工具类和HttpUrlConnection上传文件分析
  3. VPN使用指南|稳定的VPN|
  4. SSH使用教程( Bitvise Tunnelier+Chrome+Proxy Switchy)
  5. Xamarin.Forms项目无法添加服务引用
  6. Sql server中内连接语句
  7. 通过Application传递数据代码
  8. JDBC基础二
  9. Echarts-JAVA
  10. PHPcurl抓取AJAX异步内容(转载)
  11. vSphere文档中心
  12. SSH 5W学习
  13. 给Visual Studio更替皮肤和背景图
  14. centos7 环境搭建
  15. 怎样把echarts图表做成响应式的
  16. 实例 find
  17. elasticsearch简单操作
  18. 万物云平台数据转发 c# 控制台程序
  19. java并发编程:线程安全管理类--原子操作类--AtomicMarkableReference<V>
  20. Spring Security编程模型

热门文章

  1. HNUSTOJ-1690 千纸鹤
  2. python3使用hashlib进行加密
  3. js 全世界最短的IE浏览器判断代码
  4. Houdini:也许是你未曾听过的最振奋人心的 CSS 进化
  5. tableView优化方案
  6. 关于代码手写UI,xib和StoryBoard
  7. java Character类源码分析
  8. 36.React基础介绍——2019年12月24日
  9. 关于在IOS中 contenteditable=true 无法输入的问题
  10. 【NOIP2013模拟】导弹防御塔