mysql replication - slave server on one database

╄→гoц情女王★ 提交于 2019-12-03 11:41:17
Frank Fang

Yes you can

If you want to replicate just one database from master, you can set replicate-do-db in your /etc/my.cnf or set replicate-do-db as mysql argument, for example:

replicate-do-db=db01

If you have multi databases to be replicated, /etc/my.cnf should be like this:

replicate-do-db=db01
replicate-do-db=db02

If you just want slave to ignore some database, you can set replicate-ignore-db:

replicate-ignore-db=db01

More details on MySQL document: http://dev.mysql.com/doc/refman/5.1/en/replication-options-slave.html#option_mysqld_replicate-do-db

Omair Anwer

Adding these lines to the /etc/my.conf file of the slave machine solved my problem. Thanks.

replicate-do-db=Refill

However, please note that after doing this i had to restart both the databases and update the new file name and position from the master server by typing below command:

mysql> show master status;

Add this information to your MySQL on slave machine and start slave.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!