mySQL Replication:主数据库名称是否必须与从属数据库名称相同?

我已将主数据库名称设置为MDB&在Slave服务器中我设置为replicate-do-db = SDB< - 这不起作用?但是,当我将其设置为相同的DB名称时,它可以工作.是否有任何解决方案来设置1个主数据库与2个不同的从属但在同一服务器? 最佳答案 您需要指定replicate-rewrite-db选项:

--replicate-rewrite-db=from_name->to_name

Tells the slave to translate the default database (that is,the one
selected by USE) to to_name if it was from_name on the master. Only
statements involving tables are affected (not statements such as
CREATE DATABASE,DROP DATABASE,and ALTER DATABASE),and only if
from_name is the default database on the master. This does not work
for cross-database updates. To specify multiple rewrites,use this
option multiple times. The server uses the first one with a from_name
value that matches. The database name translation is done before the
–replicate-* rules are tested.

如果您只复制某些数据库,则需要指定replicate-do-db.请注意,此参数是replicate-rewrite-db应用重命名操作后的数据库名称:

--replicate-do-db=db_name

dawei

【声明】:唐山站长网内容转载自互联网,其相关言论仅代表作者个人观点绝非权威,不代表本站立场。如您发现内容存在版权问题,请提交相关链接至邮箱:bqsm@foxmail.com,我们将及时予以处理。