一、安装 mysql8.0
下载mysql 安装包http://mirrors.sohu.com/mysql/MySQL-8.0/
wget http://mirrors.sohu.com/mysql/MySQL-8.0/mysql-community-client-8.0.18-1.el7.x86_64.rpm
wget http://mirrors.sohu.com/mysql/MySQL-8.0/mysql-community-client-8.0.27-1.el7.x86_64.rpm
wget http://mirrors.sohu.com/mysql/MySQL-8.0/mysql-community-common-8.0.27-1.el7.x86_64.rpm
wget http://mirrors.sohu.com/mysql/MySQL-8.0/mysql-community-devel-8.0.27-1.el7.x86_64.rpm
wget http://mirrors.sohu.com/mysql/MySQL-8.0/mysql-community-embedded-compat-8.0.27-1.el7.x86_64.rpm
wget http://mirrors.sohu.com/mysql/MySQL-8.0/mysql-community-libs-8.0.27-1.el7.x86_64.rpm
wget http://mirrors.sohu.com/mysql/MySQL-8.0/mysql-community-libs-compat-8.0.27-1.el7.x86_64.rpm
wget http://mirrors.sohu.com/mysql/MySQL-8.0/mysql-community-server-8.0.27-1.el7.x86_64.rpm
wget http://mirrors.sohu.com/mysql/MySQL-8.0/mysql-community-client-plugins-8.0.27-1.el7.x86_64.rpm
安装mysql
yum localinstall ./mysql-community-*
启动mysql
systemctl start mysqld
查看初始密码
进入数据库修改密码
注意:ERROR 1819 (HY000): Your password does not satisfy the current policy requirements 提示密码不符合规则。
二、mysql主从复制配置
首先安装mysql 在主从服务节点安装mysql 数据库,如上操作
主库配置
1 、##编辑配置文件
[mysqld]
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
log-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid
port=3306
server-id=100 #设置server_id
gtid-mode=on #启用gtid,否则就是普通的复制架构
log-slave-updates #slave 更新是否计入日志
enforce-gtid-consistency #强制gtid 的一致性
log_bin=/data/mysql/mybinlog
max_connections=500
2 、创建主从复制专用用户
mysql -uroot -pWWW.123.com
create user ‘slave ‘@’192.168.1.%’; identified by ‘WWW.123.com’;
grant replication slave on . to ‘slave ‘@’192.168.1.%’;
3 、查看主库的日志及偏移量
#从库配置
1、编辑配置文件my.cnf
2 、进入mysql 进行配置连接
#change master to master_host=’192.168.1.37′,master_user=’slave’,\
master_password=’WWW.123.com’,\
master_port=3306,master_auto_position=1;
3 、查看slave 状态,如下图表示主从复制配置完成
Original: https://www.cnblogs.com/rickenl/p/16293791.html
Author: RickenL
Title: mysql安装及主从复制配置
原创文章受到原创版权保护。转载请注明出处:https://www.johngo689.com/505365/
转载文章受原作者版权保护。转载请注明原作者出处!