首页 > 数据库 >MySQL主从安装

MySQL主从安装

时间:2022-08-26 15:14:57浏览次数:83  
标签:slave log relay MySQL master mysql MASTER 安装 主从

mysql 5.7

 

wget -i -c http://dev.mysql.com/get/mysql57-community-release-el7-10.noarch.rpm

yum -y install mysql57-community-release-el7-10.noarch.rpm

yum -y install mysql-community-server (yum install mysql-community-server --nogpgcheck)

systemctl start  mysqld.service

grep "password" /var/log/mysqld.log

mysql -p

ALTER USER 'root'@'localhost' IDENTIFIED BY 'Password';

exit

systemctl restart  mysqld.service

 

(首先需要设置密码的验证强度等级,设置 validate_password_policy 的全局参数为 LOW 即可,
输入设值语句 “ set global validate_password_policy=LOW; ” 进行设值,)

 

 

 

CREATE USER 'slave'@'%' IDENTIFIED BY 'Oig#123456';

GRANT REPLICATION SLAVE, REPLICATION CLIENT ON *.* TO 'slave'@'%';

GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'Password';

show variables like 'log_bin';

show master status;

 

 

 

stop slave;

mysql> CHANGE MASTER TO MASTER_HOST='10.16.129.12', MASTER_PORT=3306, MASTER_USER='slave', MASTER_PASSWORD='Ab!@3456', MASTER_LOG_FILE='mysql-bin.001204',  MASTER_LOG_POS=862149423;

start slave;

 

show slave status\G

 

 

 

 

 

断电导致从库故障

Last_SQL_Error: Relay log read failure: Could not parse relay log event entry. The possible reasons are: the master's binary log is corrupted (you can check this by running 'mysqlbinlog' on the binary log), the slave's relay log is corrupted (you can check this by running 'mysqlbinlog' on the relay log), a network problem, or a bug in the master's or slave's MySQL code. If you want to check the master's binary log or slave's relay log, you will be able to know their names by issuing 'SHOW SLAVE STATUS' on this slave.

 

查看错误 cat SRV-MYSQL-Slave.err

查看mysql主从密码cat master.info

 

Slave SQL: If a crash happens this configuration does not guarantee that the relay log info will be consistent, Error_code: 02021-08-17 16:28:10 4211 [Note] Slave SQL thread initialized, starting replication in log 'mysql-bin.014017' at position 807538114, relay log './mysql-relay-bin.016471' position: 807538277

 

change master to master_host='mysqlmaster1.database.oigbuy.com',master_port=3306,master_user='repl_user',master_password='VzOkf65kfDIkHN5XUJJx',master_log_file='mysql-bin.014017',master_log_pos=807538114;

标签:slave,log,relay,MySQL,master,mysql,MASTER,安装,主从
From: https://www.cnblogs.com/quemengqio/p/16627582.html

相关文章

  • Linux安装python并配置环境变量
    1.获取python3源码我们访问这个网址,就可以看到全部的python下载方式:【https://www.python.org/downloads/】   本人下载的是3.10.6版本   2.安装Python这......
  • cento7.6下yum安装Jenkins
    注意:有些java版本跟Jenkins版本不匹配 下载Jenkins源sudowget-O/etc/yum.repos.d/jenkins.repo\https://pkg.jenkins.io/redhat/jenkins.reposudorpm--imp......
  • MySql 建表语句
    CREATETABLEIFNOTEXISTSnsy_scm.`publish_store_product_spec`(`id`INT(11)NOTNULLAUTO_INCREMENT,`publish_store_product_id`INT(11)......
  • Mysql 系列 | join 优化
    上一篇中说了join语句的执行过程,了解了深层逻辑,则优化方案呼之欲出。Multi-RangeRead(MRR)优化select*fromt1wherea>=1anda<=100;回表时,根据ID去主键索引......
  • 【超详细】Apache Durid从入门到安装详细教程
    1.Durid概述ApacheDruid是一个集时间序列数据库、数据仓库和全文检索系统特点于一体的分析性数据平台。本文将带你简单了解Druid的特性,使用场景,技术特点和架构。这将......
  • Mysql查询当前年份、去年,当前月份、上个月′,当前周、上一周新增数据
    查询当前年份新增数据select*fromtestwhereYEAR(create_time)=YEAR(NOW())查询当去年份新增数据<iftest="param.lastYearStatus!=null">andYEAR(creat......
  • Mysql按日、周、月进行分组统计
    1)按天统计:selectDATE_FORMAT(start_time,'%Y%m%d')days,count(product_no)countfromtestgroupbydays;2)按周统计:selectDATE_FORMAT(start_time,'%Y%u')week......
  • 最小化安装killall不可用
    最小化安装killall不可用最小化安装Centos7.4后,发现killall命令不可用 使用了以下命令,查看软件包名:yumsearchkillall 查找后发现应使用这个安装包yum-yinsta......
  • macOS12.5安装Xcode
    1最好是直接去官网下载历史版本的安装包,下载下来安装就好了;2如果你选择APPstore,下载+安装可能要好久,可能网络好的时候很快下载完,但是会一直卡在安装页面:  这个时候......
  • MySQL在grant时报错ERROR 1064 (42000)
    网上查到的grant方式大多会报错,主要原因是MySQL版本8.0后不能再使用原来的方式查询MySQL版本SELECTversion();在8.0版本下grantallprivilegesontest.*tote......