资讯

精准传达 • 有效沟通

从品牌网站建设到网络营销策划,从策略到执行的一站式服务

mysql中怎么使用replication修改库名

这篇文章将为大家详细讲解有关MySQL中怎么使用replication修改库名,文章内容质量较高,因此小编分享给大家做个参考,希望大家阅读完这篇文章后对相关知识有一定的了解。

十载的纳雍网站建设经验,针对设计、前端、开发、售后、文案、推广等六对一服务,响应快,48小时及时工作处理。网络营销推广的优势是能够根据用户设备显示端的尺寸不同,自动调整纳雍建站的显示方式,使网站能够适用不同显示终端,在浏览器中调整网站的宽度,无论在任何一种浏览器上浏览网站,都能展现优雅布局与设计,从而大程度地提升浏览体验。创新互联公司从事“纳雍网站设计”,“纳雍网站推广”以来,每个客户项目都认真落实执行。

replication 修改库名

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


Command-Line Format --replicate-rewrite-db=old_name->new_name
Option-File Format replicate-rewrite-db
  Permitted Values
Type        string


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.
If you use this option on the command line and the “>” character is special to your command interpreter, quote the option value. For example:
shell> mysqld --replicate-rewrite-db="olddb->newdb"
 
适用情况:
比如,master与slave同步test这个库,但因为需要slave需要将test改名为testbak,master不能改,就需要这个参数
在my.cnf中加入
binlog-do-db=test
replicate-rewrite-db=test->testbak
重启mysql,在master的test库修改东西,看slave的hackers库是否已经修改。查看show slave status是否正常。

关于mysql中怎么使用replication修改库名就分享到这里了,希望以上内容可以对大家有一定的帮助,可以学到更多知识。如果觉得文章不错,可以把它分享出去让更多的人看到。


网站名称:mysql中怎么使用replication修改库名
网站网址:http://cdkjz.cn/article/jpcsge.html
多年建站经验

多一份参考,总有益处

联系快上网,免费获得专属《策划方案》及报价

咨询相关问题或预约面谈,可以通过以下方式与我们联系

大客户专线   成都:13518219792   座机:028-86922220