最新文章专题视频专题问答1问答10问答100问答1000问答2000关键字专题1关键字专题50关键字专题500关键字专题1500TAG最新视频文章推荐1 推荐3 推荐5 推荐7 推荐9 推荐11 推荐13 推荐15 推荐17 推荐19 推荐21 推荐23 推荐25 推荐27 推荐29 推荐31 推荐33 推荐35 推荐37视频文章20视频文章30视频文章40视频文章50视频文章60 视频文章70视频文章80视频文章90视频文章100视频文章120视频文章140 视频2关键字专题关键字专题tag2tag3文章专题文章专题2文章索引1文章索引2文章索引3文章索引4文章索引5123456789101112131415文章专题3
当前位置: 首页 - 科技 - 知识百科 - 正文

mysqlreplication修改库名_MySQL

来源:动视网 责编:小采 时间:2020-11-09 18:08:22
文档

mysqlreplication修改库名_MySQL

mysqlreplication修改库名_MySQL:bitsCN.com mysql replication 修改库名 --replicate-rewrite-db=from_name->to_name Command-Line Format --replicate-rewrite-db=old_name->new_name Option-File Format replicate-rewrite-d
推荐度:
导读mysqlreplication修改库名_MySQL:bitsCN.com mysql replication 修改库名 --replicate-rewrite-db=from_name->to_name Command-Line Format --replicate-rewrite-db=old_name->new_name Option-File Format replicate-rewrite-d


bitsCN.com

mysql 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是否正常。

总结一下:slave修改库名,master不变的情况下


题外话:在遇到slave query 同步错误时,可以使用如下方法解决:
slave stop;
set global sql_slave_skip_counter=1;
slave start;
不过有可能会丢失数据。先看清楚是因为什么导致的错误。

bitsCN.com

文档

mysqlreplication修改库名_MySQL

mysqlreplication修改库名_MySQL:bitsCN.com mysql replication 修改库名 --replicate-rewrite-db=from_name->to_name Command-Line Format --replicate-rewrite-db=old_name->new_name Option-File Format replicate-rewrite-d
推荐度:
  • 热门焦点

最新推荐

猜你喜欢

热门推荐

专题
Top