docker|docker mysql5.6 开启binlog

简单的事情折腾了2小时,闹心。

This will start a new container some-mysql where the MySQL instance uses the combined startup settings from /etc/mysql/my.cnf and /etc/mysql/conf.d/config-file.cnf, with settings from the latter taking precedence.
看描述以为自定义配置可以随便命名,结果试了几次都不好使。转换思路,测试命名和容器已有文件一致,就ok了。
mysql5.6的my.cnf会加载下面两个目录
!includedir /etc/mysql/conf.d/ !includedir /etc/mysql/mysql.conf.d/

  1. 新增conf/docker.cnf
[mysqld] skip-host-cache skip-name-resolve# 打开binlog log_bin = mysql-bin# 关闭binlog # skip-log-bin

  1. run时挂载配置
-v `pwd`/conf:/etc/mysql/conf.d

  1. 连接mysql,查看binlog状态

    docker|docker mysql5.6 开启binlog
    文章图片
    image.png
【docker|docker mysql5.6 开启binlog】安装个vim,方便测试
apt-get update
apt-get install -y vim

    推荐阅读