Administration

Administration, Backup, Replication, and Partitioning

Most administration acts on the whole server, so this section runs two MySQL 9.7.2 524 containers of its own (Running MySQL in Docker): a source on port 3317 and a replica on 3417, with global transaction identifiers (GTIDs) on. Credentials sit in ~/.my.cnf ([client] with user, password and host=127.0.0.1, mode 600), so commands pass only the port. shop is loaded on the source.

A source and a replica on one Docker networkShell
docker network create shop-net
docker run -d --name source --hostname source --network shop-net \
  -v source-data:/var/lib/mysql -e MYSQL_ROOT_PASSWORD=secret -p 3317:3306 \
  mysql:9.7 --server-id=1 --gtid-mode=ON --enforce-gtid-consistency=ON
docker run -d --name replica --hostname replica --network shop-net \
  -v replica-data:/var/lib/mysql -e MYSQL_ROOT_PASSWORD=secret -p 3417:3306 \
  mysql:9.7 --server-id=2 --gtid-mode=ON --enforce-gtid-consistency=ON --read-only=ON

The binary log is on by default in ROW format (SELECT @@log_bin, @@binlog_format returns 1 and ROW); setting binlog_format raises warning 1287, deprecated, because row logging is the future.

Subsections