docker pull mysql:5.6
docker run -d -p 3306:3306 --name mysql5.6 -e MYSQL_ROOT_PASSWORD=123456 --privileged=true mysql:5.6
docker exec -it mysql5.6 bash
find /etc -name mysqld.cnf
找到配置文件/etc/mysql/mysql.conf.d/mysqld.cnf
docker cp mysql5.6:/etc/mysql/mysql.conf.d/mysqld.cnf ./
vim mysqld.cnf
追加
log-bin=/var/lib/mysql/mysql-bin
server-id=1
binlog_format=MIXED
expire_logs_days=30
docker cp ./mysqld.cnf mysql5.6:/etc/mysql/mysql.conf.d/
docker restart mysql5.6
成功开启binlog