一、docker快速安装mysql(3307端口)
docker run --name mysql3307 -p 3307:3306 -e MYSQL_ROOT_PASSWORD=rootpassword --restart always -d mysql:5.7.30
binlog配置
docker exec -it mysql3307 bash
cd /etc/mysql/mysql.conf.d
cat -n mysqld.cnf
往pid-file那行前插入,注意,一定要写在pid-file配置前面
sed '30 ilog-bin=mysql-bin\nbinlog-format=ROW\nserver_id=1' -i mysqld.cnf
mysql中创建canal_user用户,密码canal_password,赋予select等权限
mysql -uroot -p
CREATE USER canal_user IDENTIFIED BY 'canal_password';
GRANT SELECT, REPLICATION SLAVE, REPLICATION CLIENT ON *.* TO 'canal_user'@'%';
FLUSH PRIVILEGES;
exit
docker重启mysql3307
exit
docker restart mysql3307
docker exec -it mysql3307 bash
mysql -uroot -p
show variables like