mysql搭建主从数据库

主从复制
常见构架:在线热备,高可用,读写分离等
主从搭建
从mysql>CHANGE MASTER TO MASTER_HOST='192.168.214.143',MASTER_USER='replic',MASTER_PASSWORD='oracle',MASTER_PORT=32111,MASTER_AUTO_POSITION=194;
MASTER_AUTO_POSITION为主库binlog的号
主mysql> show master status;

或者

CHANGE MASTER TO
MASTER_HOST='192.168.214.144',
MASTER_USER='replic',
MASTER_PASSWORD='oracle',
MASTER_PORT=32111,
MASTER_LOG_FILE='master01-bin.000014',
MASTER_LOG_POS=473103869,
MASTER_CONNECT_RETRY=10;
报错误1776时reset slave all;清空一下
从mysql> show slave status G;
从mysql> start slave;
主mysql> show slave hosts;
主mysql> set global tmp_table_size=671088640;
主mysql> set global max_heap_table_size=671088640;
原文地址:https://www.cnblogs.com/Knight7971/p/9588598.html