# Install Tinybird CLI and login
pip install tinybird-cli
tb login # choose first option, create workspace: mysql_to_ch
# Start Tinybird Local
tb local start -d
# Build the Tinybird project (datasource definition already in datasources/)
tb build
# Clone the syncer source into syncer/ (Tinybird fork of clickhouse-mysql-data-reader)
git clone git@github.com:tinybirdco/clickhouse-mysql-data-reader.git syncer
# Get a local Tinybird token for the syncer
tb token copy "workspace admin token" && export TB_TOKEN=$(pbpaste)
# Start MySQL 8.0 with binlog enabled and a replication user
docker compose up -d mysql
# Start the syncer -- long-running, watches MySQL binlog and uploads row events to local Tinybird
docker compose up --build -d syncer
# Insert 5 random rows into MySQL (run as many times as you want)
pip3.13 install pymysql
python3.13 fake_data.py
# Verify the rows are in MySQL
docker exec mysql-8 mysql -ureader -pqwerty -e "SELECT * FROM testdb.events ORDER BY id DESC LIMIT 10;"
# Check the syncer is picking up events
docker compose logs -f syncer
# Check the data landed in Tinybird
tb sql "SELECT * FROM raw_landing"
# Cleanup
tb datasource truncate raw_landing --yes
docker compose exec mysql mysql -uroot -proot -e "TRUNCATE TABLE testdb.events;"
docker compose down -v
tb local stopPrerequisites: cleanup from section above has been done, TB_TOKEN is still exported.
docker compose -f docker-compose.yml -f docker-compose.84.yml up -d mysql
docker compose -f docker-compose.yml -f docker-compose.84.yml up --build -d syncer
python3.13 fake_data.py
docker compose logs -f syncer
# syncer loops with: SHOW MASTER STATUS -- syntax errorPrerequisites: cleanup from section above has been done, TB_TOKEN is still exported.
Dockerfile.syncer84 clones the patched fork from git by default. To use a
local copy instead, clone it into mysql-replication/ and uncomment the
COPY/RUN pip install lines in Dockerfile.syncer84 (commenting out the git sed).
# Tear down any previous containers
docker compose -f docker-compose.yml -f docker-compose.84.yml down -v
# Start MySQL 8.4
docker compose -f docker-compose.yml -f docker-compose.84.yml up -d mysql
# Build and start the syncer with the patched library
docker compose -f docker-compose.yml -f docker-compose.84.yml up --build -d syncer
# Insert test data
python3.13 fake_data.py
# Confirm the syncer is processing events without errors
docker compose -f docker-compose.yml -f docker-compose.84.yml logs -f syncer
# Confirm data landed in Tinybird
tb sql "SELECT * FROM raw_landing"
# Cleanup
docker compose -f docker-compose.yml -f docker-compose.84.yml down -v