---
title: MySQL 5.1 Replication
url: https://sammy.hk/mysql-5-1-replication/
author: Sammy Fung
published: 2012-11-01T22:28:40+08:00
modified: 2021-06-01T00:43:14+08:00
description: "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 …"
categories: ["開放源碼"]
tags: ["資料庫"]
source: https://sammy.hk
---
To configure data replication between 2 MySQL system, we can follow [MySQL 5.1 Replication HOWTO](http://dev.mysql.com/doc/refman/5.1/en/replication-howto.html) 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](http://dev.mysql.com/doc/refman/5.1/en/replication-howto-masterbaseconfig.html) 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](http://dev.mysql.com/doc/refman/5.1/en/replication-howto-slavebaseconfig.html) to do the configuration, and restore database files copied from existing system to local /var/lib/mysql/ directory.

\[mysqld\]
server-id=2

### 相關文章：

1. [【Ubuntu 12.04】AppArmor 令 MySQL 不能啟動](https://sammy.hk/ubuntu-12-04-apparmor-%e4%bb%a4-mysql-%e4%b8%8d%e8%83%bd%e5%95%9f%e5%8b%95/ "【Ubuntu 12.04】AppArmor 令 MySQL 不能啟動")
2. [Linux Forum Asia 2005 之後感](https://sammy.hk/linux-forum-asia-2005-%e4%b9%8b%e5%be%8c%e6%84%9f/ "Linux Forum Asia 2005 之後感")
3. [重新安裝 Serendipity](https://sammy.hk/reinstall-serendipity/ "重新安裝 Serendipity")
4. [近期喜歡上搞 Web Application](https://sammy.hk/interests-to-code-webapp/ "近期喜歡上搞 Web Application")
