残月的小站 - 备份
type: channel
link: https://blog.dfcraft.cn/index.php/tag/备份/
items: MySQL 8.4 主从架构

MySQL 8.4 主从架构
type: item
date: 2024-05-31T14:56:00+08:00
description: 安装MySQL首先在使用前，先安装MYSQL下载可通过下方链接https://dev.mysql.com/downloads/mysql/mysql-8.4.0 Linux通用https://cdn.mysql.com//Downloads/MySQL-8.4/mysql-community-server-8.4.0-1.el7.x86_64.rpm https://cdn.mysql.com//Downloads/MySQL-8.4/mysql-community-client-8.4.0-1.el7.x86_64.rpm https://cdn.mysql.com//Downloads/MySQL-8.4/mysql-community-libs-8.4.0-1.el7.x86_64.rpm https://cdn.mysql.com//Downloads/MySQL-8.4/mysql-community-common-8.4.0-1.el7.x86_64.rpmshow variables like '%skip_network%'create user 'repl'@'%' identified by '321654qaz.Q';GRANT REPLICATION SLAVE ON *.* TO 'repl'@'%';在从数据库中设置mysql 8.0之前和之后使用的命令不一样，例如8.0之前使用CHANGE MASTER TO MASTER_HOST='192.168.37.100',MASTER_PORT=3306,MASTER_USER='repl',MASTER_PASSWORD='321654qaz.Q';8.0之后使用CHANGE REPLICATION SOURCE TO SOURCE_HOST='192.168.37.100',SOURCE_PORT=3306,SOURCE_USER='repl',SOURCE_PASSWORD='321654. ![lwukeq09.png](https://blog.dfcraft.cn/usr/uploads/2024/05/1265215117.png) ';START REPLICASHOW REPLICA STATUS G;