我将我的从属设备设置为不复制“ mysql”数据库,如本说明中所述 SHOW SLAVE STATUS\G;
Slave_IO_State: Waiting for master to send event
Master_Host: 127.0.0.1
Master_User: replication
Master_Port: 3306
Connect_Retry: 60
Master_Log_File: master-bin.000001
Read_Master_Log_Pos: 1660
Relay_Log_File: mysql-relay-bin.000004
Relay_Log_Pos: 478
Relay_Master_Log_File: master-bin.000001
Slave_IO_Running: Yes
Slave_SQL_Running: Yes
Replicate_Do_DB:
**Replicate_Ignore_DB: mysql**
Replicate_Do_Table:
Replicate_Ignore_Table:
Replicate_Wild_Do_Table:
Replicate_Wild_Ignore_Table:
Last_Errno: 0
Last_Error:
Skip_Counter: 0
Exec_Master_Log_Pos: 1660
Relay_Log_Space: 633
Until_Condition: None
Until_Log_File:
Until_Log_Pos: 0
现在,如果我转到MASTER服务器并发出GRANT
和FLUSH PRIVILEGES
:
GRANT SELECT ON *.* TO `foo`@`localhost` IDENTIFIED BY 'bar';
FLUSH PRIVILEGES;
然后,我回到SLAVE服务器并发出:
SHOW GRANTS FOR `foo`@`localhost`;
并收到响应:
+-------------------------------------------------------------------------------------------------------------+
| Grants for foo@localhost |
+-------------------------------------------------------------------------------------------------------------+
| GRANT SELECT ON *.* TO 'foo'@'localhost' IDENTIFIED BY PASSWORD '*E8D46CE25265E545D225A8A6F1BAF642FEBEE5CB' |
+-------------------------------------------------------------------------------------------------------------+
1 row in set (0.00 sec)
如何阻止从属复制mysql数据库的更改?我认为'replicate_ignore_db'就足够了。
_do_
和_ignore_
子句,请仔细研究算法。它变得棘手。