--- id: mysql-replication version: "1.0.17" license: Apache 2 license_treatment: permissive maintenance: active --- # mysql-replication — Pure Python Implementation of MySQL replication protocol build on top of PyMYSQL. License: permissive · Maintenance: active · Downloads: 453.6K/mo ## What it is and what it does mysql-replication is a pure Python library that implements the MySQL replication protocol on top of pymysql, allowing you to connect to a MySQL server and stream binary log events in real time. It captures INSERT, UPDATE, and DELETE operations with their full row data and original SQL queries, making it possible to react to database changes as they happen. The library is designed for building change data capture pipelines—feeding database changes into NoSQL systems, search engines, caches, analytics platforms, or audit logs. It works with MySQL 5.5 through 8.0.14 and MariaDB 10.6, and has been used in production by medium-scale internet companies. Configuration requires enabling binary logging on the MySQL server and setting specific binlog parameters; once set up, the library handles the protocol details transparently. Use it for: - Replicate MySQL data to NoSQL databases or data warehouses in near real time. - Invalidate application caches automatically when rows change in the database, eliminating stale data. - Stream database changes to event brokers for event-driven architectures and downstream processing. - Build audit trails and compliance logs by capturing all mutations to sensitive tables. - Feed real-time analytics systems with fresh data from transactional databases. ## Worth the install? AI-flagged interpretation of the facts above — verify before relying. Reads MySQL binary logs and streams replication events (inserts, updates, deletes) with their data and raw SQL queries to Python, enabling real-time capture of database changes. Yes. The package is actively maintained, has low install friction, carries a permissive license, and fills a clear niche in MySQL change capture. It is production-tested and widely adopted for CDC pipelines. Install it if you need to react to MySQL changes in real time; skip it if your use case does not require streaming binary log events or if you are not using MySQL. ## Install pip install mysql-replication uv add mysql-replication poetry add mysql-replication ## Installing mysql-replication Before you install: Low friction: pure Python wheel with only two runtime dependencies (packaging and pymysql). Actively maintained with a recent release and 2415 repository stars. Tested against MySQL 5.5–8.0.14 and MariaDB 10.6. License in practice: Licensed under Apache 2 (permissive), allowing commercial and private use with minimal restrictions—suitable for production deployments and proprietary integrations. Quickstart: pip install mysql-replication from pymysqlreplication import BinLogStreamReader mysql_settings = {'host': '127.0.0.1', 'port': 3306, 'user': 'root', 'passwd': ''} stream = BinLogStreamReader(connection_settings=mysql_settings, server_id=100) for binlogevent in stream: binlogevent.dump() stream.close() MySQL server must have binary logging enabled with binlog_format='ROW', and for MySQL 8.0.14+ requires binlog_row_metadata='FULL' and binlog_row_image='FULL'. Verify before relying: - Whether the library handles all MySQL 8.0 versions beyond 8.0.14 or only that specific release forward. - Real-world performance characteristics and throughput limits under high-volume replication scenarios. - Completeness of support for all binary log event types and edge cases in production environments. - Compatibility with Python versions beyond 3.14 or earlier than 3.10. ## Package facts - License: Apache 2 (permissive) - Python support: unspecified - Install friction: low - Maintenance: active - Downloads: 453.6K/month (top 15,000 on PyPI) - Known vulnerabilities: none known ## Tags mysql binary log reader, mysql change data capture, mysql replication protocol python, mysql binlog streaming, mysql cdc events, database change capture, mysql event replication, change-data-capture, mysql-binlog, replication [View on SkillFed](https://skillfed.io/packages/mysql-replication) · [View on PyPI](https://pypi.org/project/mysql-replication/)