1、從官網下載mysql8.0
2、修改配置文件
主數據庫配置修改:
主數據庫下在根目錄下面,增加my.ini文件,增加
[mysqld]
log-bin=mysql-bin
server-id=1
安裝服務 mysqld install mysql
啓動服務 net start mysql
從數據庫修改:
[mysqld]
log-bin=mysql-bin
server-id=2
安裝服務 mysqld install mysql1
啓動服務 net start mysql1
3、 修改主動配置:
主數據創建用戶:
create user 'slave1'@'localhost' idetified by '1111';
GRANT REPLICATION SLAVE ON *.* TO 'slave1'@'localhost';
flush privileges;
查看下主數據的binlog
show master status;
從數據庫修改:
stop slave;
change master to master_host='localhost',master_user='slave1',master_password='1111',master_log_file='mysql-bin.000003',master_log_pos=155;
start slave;
show slave status \G;
配置正確。
我在服務啓動中遇到幾個問題,
uuid不一致,可以去 data目錄下修改auto.cnf 修改下
在主數據庫創建下數據庫和表,測試下。