Docker MySQL 启动和binlog配置修改

docker run \
-d \
--name mysql \
-p 3306:3306 \
--restart=always \ 
--privileged=tru \
-e MYSQL_ROOT_PASSWORD=root \
-v /home/mysql/data/:/var/lib/mysql/ \ 
-v/home/mysql/config/:/etc/mysql/mysql.conf.d \
--character-set-server=utf8mb4 \
--collation-server=utf8mb4_unicode_ci \ 
--lower_case_table_names=1 \
mysql:5.7

进入容器修改配置binglog

docker run --name mysql -e MYSQL_ROOT_PASSWORD=root -p 3306:3306 --re start=always -d mysql

docker exec -it mysql /bin/bash  

mysql -uroot -p

show variables like 'log_bin';

cd /etc/mysql/mysql.conf.d

cat mysql.conf.d

echo -e '[mysqld]\npid-file\t= /var/run/mysqld/mysqld.pid\nsocket\t= /var/run/mysqld/mysqld.sock\ndatadir\t= /var/lib/mysql\nsymbolic-links=0\nserver-id = 1\nlog-bin = binlog\nlog-bin-index = binlog.index'>mysqld.cnf
posted @ 2020-02-29 12:33  HANFAN  阅读(1453)  评论(0编辑  收藏  举报