开发者

mysql schema changes with master & slave

If I have a MySQL master-slave set-up and I change the schema on the master (e.g. ALTER TABLE/CREATE TABLE, etc), will those cha开发者_运维百科nges get replicated over to the slave?


The answer is actually that it depends on the type of replication you are using and how your replication setup is configured.

Statement-based replication? Applying ALTER TABLE on the master? Not using any of the non-replication-safe SQL commands [1] (e.g. non-deterministic functions such as RAND() )?

CREATE and ALTER should replicate just fine.

In some situations it may be useful to stop slave; [run script on master]; [run script on slave]; start slave; An example is here[2].

[1] http://dev.mysql.com/doc/refman/5.1/en/replication-sbr-rbr.html

[2] http://dev.mysql.com/doc/refman/5.1/en/replication-solutions-diffengines.html


No, you have to change it manually.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜