MySQL數據同步配置
----------------------
要求MySQL版本>=3.23.54
<...>指代變量
1、Master端配置:
Slave同步賬號權限:
GRANT FILE ON
或者
INSERT INTO user VALUES('
FLUSH PRIVILEGES;
Master啟動配置文件:
[MySQLd]
log-bin
binlog-do-db=
server-id=
或者:
[MySQLd]
log-bin
replicate-wild-do-table=
replicate-wild-ignore-table=
server-id=
2、Slave端配置
Slave啟動配置文件:
[MySQLd]
master-host=
master-user=
master-passWord=
master-port=
server-id=
3、停止服務
MySQLadmin -S
MySQLadmin -S
4、拷貝數據
5、啟動Master服務
Master數據庫
6、啟動Slave服務
<開始位置,初始必須為73>
<出錯重試間隔(s),例如60>
7、測試/監視
Master數據庫中執行
SHOW MASTER STATUS;
應顯示
+---------------------------+-----------+--------------+------------------+
| File | Position | Binlog_do_db | Binlog_ignore_db |
+---------------------------+-----------+--------------+------------------+
|
+---------------------------+-----------+--------------+------------------+
Slave數據庫中執行
SHOW SLAVE STATUS;
應顯示
+---------------+-------------+-------------+---------------+---------------------------+-----------+---------------+-----------------+---------------------+------------+------------+--------------+
| Master_Host | Master_User |