1、停止mysql服务:service mysqld stop
2、vim /etc/my.cnf
[mysqld]
server-id=3
replicate-do-db=pres_eims
replicate-do-db=pres_system
replicate-do-db=pres_business
replicate-do-db=pres_sp_business
replicate-ignore-db=pres_options
replicate-ignore-db=test
replicate-ignore-db=pres_iams
replicate-rewrite-db = pres_eims -> riskdb
replicate-rewrite-db = pres_system -> pres_system_slave
replicate-rewrite-db = pres_business -> pres_business_slave
replicate-rewrite-db = pres_sp_business -> pres_sp_business
#replicate-wild-do-table=riskdb.test01
#replicate-wild-do-table=riskdb.test02
port = 33066
basedir = /opt/mysql-8
datadir = /storage/mysql-8/data
#socket = /var/run/mysql/mysql.sock
#socket = /tmp/mysql/mysql.sock
character-set-server = utf8mb4
#collation-server = unf8mb4_unicode_ci
max_connections = 1000
max_allowed_packet = 4000M
default_authentication_plugin = mysql_native_password
secure_file_priv = ''
[client]
port = 33066
#socket = /var/run/mysql/mysql.sock
#socket = /tmp/mysql/mysql.sock
3 、 启动数据库服务:service mysqld start
4、mysql -uroot -p
5、stop slave ;
6、查看master的状态:
show master status;
7、
change master to master_host='ip',
master_port=30306,
master_user='slave',
master_password=' ',
master_log_file='mysql-bin.000048',
master_log_pos=940915971;
8、start slave;
9、show slave status\G;