MySQL 5.1 Replication

To configure data replication between 2 MySQL system, we can follow MySQL 5.1 Replication HOWTO document. If the master system is a current production database system, we should stop and copy database files on /var/lib/mysql to new system, and follow documentation to modify the MySQL config files.

[mysqld]
log-bin=mysql-bin
server-id=1

For InnoDB:
[mysqld]
sync_binlog=1
[innodb]
innodb_flush_log_at_trx_commit=1

On the slave system, we can follow slave base config documentation to do the configuration, and restore database files copied from existing system to local /var/lib/mysql/ directory.

[mysqld]
server-id=2

About Sammy Fung

Sammy Fung 是開放源碼倡導者,Python Software Foundation Fellow,創辦 Open Source Hong Kong、香港開源年會及 PyCon HK,曾任 GNOME Foundation 董事,現為開發者關係專家,致力推廣開源軟件、開放數據與開源 AI。