• GreatSQL社区原创内容未经授权不得随意使用,转载请联系小编并注明来源。

一、部署实例

1.下载2个软件

http://ftp.kaist.ac.kr/mysql/Downloads/MySQL-5.7/mysql-5.7.35-winx64.zip
http://ftp.kaist.ac.kr/mysql/Downloads/MySQL-8.0/mysql-8.0.26-winx64.zip

2.解压一下

3.初始化

  • 记录下密码
C:\Users\Administrator>D:\test\mysql-5.7.35-winx64\bin\mysqld --initialize --console
2022-01-20T03:37:59.769162Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2022-01-20T03:38:03.808644Z 0 [Warning] InnoDB: New log files created, LSN=45790
2022-01-20T03:38:03.901775Z 0 [Warning] InnoDB: Creating foreign key constraint system tables.
2022-01-20T03:38:04.079914Z 0 [Warning] No existing UUID has been found, so we assume that this is the first time that this server has been started. Generating a new UUID: 5fd0428e-79a2-11ec-b336-00155d9ebf27.
2022-01-20T03:38:04.092275Z 0 [Warning] Gtid table is not ready to be used. Table 'mysql.gtid_executed' cannot be opened.
2022-01-20T03:38:05.824394Z 0 [Warning] A deprecated TLS version TLSv1 is enabled. Please use TLSv1.2 or higher.
2022-01-20T03:38:05.824844Z 0 [Warning] A deprecated TLS version TLSv1.1 is enabled. Please use TLSv1.2 or higher.
2022-01-20T03:38:05.826505Z 0 [Warning] CA certificate ca.pem is self signed.
2022-01-20T03:38:07.018691Z 1 [Note] A temporary password is generated for root@localhost: pE.Yu96:XQEp
  • 初始化数据如下图,默认是在安装程序的data目录下面

  • 把初始化的数据拷贝到自定义的数据目录。
  • 添加下my.ini配置
[mysqld]
port=3306
character_set_server=utf8
basedir=D:/test/mysql-5.7.35-winx64
datadir=D:/test/data3306
server-id=1
sql_mode=NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION
lower_case_table_names=1
innodb_file_per_table = 1
log_timestamps=SYSTEM log-error = error.log
slow_query_log = 1
slow_query_log_file = slow.log
long_query_time = 5
log-bin = binlog
binlog_format = row
expire_logs_days = 15
log_bin_trust_function_creators = 1 [client]
default-character-set=utf8

4.安装服务

C:\Users\Administrator>D:\test\mysql-5.7.35-winx64\bin\mysqld --install mysql3306 --defaults-file=D:\test\data3306\my.ini
Service successfully installed.

5.开启

C:\Users\Administrator>net start mysql3306
mysql3306 服务正在启动 .
mysql3306 服务已经启动成功。

--------------------------------以上安装了一个3306,依葫芦画瓢再安装一个3307----------------------------------

D:\test\mysql-5.7.35-winx64\bin\mysqld --initialize --console
2022-01-20T05:38:55.054718Z 1 [Note] A temporary password is generated for root@localhost: E)+H2UUpeJRf
D:\test\mysql-5.7.35-winx64\bin\mysqld --install mysql3307 --defaults-file=D:\test\data3307\my.ini
mysql3307 服务正在启动 .
mysql3307 服务已经启动成功。
  • 查看服务信息

6.修改密码

C:\Users\Administrator>cd /d d:\test\mysql-5.7.35-winx64\bin
d:\test\mysql-5.7.35-winx64\bin>mysql -uroot -ppE.Yu96:XQEp
mysql: [Warning] Using a password on the command line interface can be insecure.
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.7.35-log
Copyright (c) 2000, 2021, Oracle and/or its affiliates.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql> ALTER USER 'root'@'localhost' IDENTIFIED BY 'GreatSQL';
Query OK, 0 rows affected (0.01 sec)
mysql> flush privileges;
Query OK, 0 rows affected (0.01 sec) # 然后重新登陆一下
d:\test\mysql-5.7.35-winx64\bin>mysql -uroot -p"GreatSQL" -P3307

二、建立主从

1.主节点建表等

mysql> create table t1(id int(1) not null auto_increment , name varchar(64),primary key(id));
Query OK, 0 rows affected (0.06 sec) mysql> insert into t1 values(1,'GreatSQL');
Query OK, 1 row affected (0.01 sec)

2.迁移数据

d:\test\mysql-5.7.35-winx64\bin>mysqldump.exe -uroot -pGreatSQL -P3306 --single-transaction --master_data=2 --set-gtid-purged=OFF --databases test > d:\test.sql
mysqldump: [Warning] Using a password on the command line interface can be insecure. d:\test\mysql-5.7.35-winx64\bin>mysql -uroot -pGreatSQL -P3307 < d:\test.sql
mysql: [Warning] Using a password on the command line interface can be insecure.

3.主节点赋权

CREATE USER `sync`@`127.0.0.1` IDENTIFIED BY 'sync';
GRANT Replication Slave ON *.* TO `sync`@`127.0.0.1`;
flush privileges;

4.看下dump文件的pos值

d:\test\mysql-5.7.35-winx64\bin>more d:\test.sql
-- MySQL dump 10.13 Distrib 5.7.35, for Win64 (x86_64)
......
-- Current Database: `test`
-- CHANGE MASTER TO MASTER_LOG_FILE='binlog.000002', MASTER_LOG_POS=1350;

5.从节点建立同步

change master to master_host="127.0.0.1",master_port=3306,MASTER_USER='sync',MASTER_PASSWORD='sync',MASTER_LOG_FILE='binlog.000002', MASTER_LOG_POS=1350;
start slave;

6.完成同步

mysql> show slave status\G;
*************************** 1. row ***************************
Slave_IO_State: Waiting for master to send event
Master_Host: 127.0.0.1
Master_User: sync
Master_Port: 3306
Connect_Retry: 60
Master_Log_File: binlog.000002
Read_Master_Log_Pos: 1959
Relay_Log_File: YOS-DAAJTV9J5RF-relay-bin.000003
Relay_Log_Pos: 926
Relay_Master_Log_File: binlog.000002
Slave_IO_Running: Yes
Slave_SQL_Running: Yes
Replicate_Do_DB:
Replicate_Ignore_DB:
Replicate_Do_Table:
Replicate_Ignore_Table:
Replicate_Wild_Do_Table:
Replicate_Wild_Ignore_Table:
Last_Errno: 0
Last_Error:
Skip_Counter: 0
Exec_Master_Log_Pos: 1959
Relay_Log_Space: 1143
Until_Condition: None
Until_Log_File:
Until_Log_Pos: 0
Master_SSL_Allowed: No
Master_SSL_CA_File:
Master_SSL_CA_Path:
Master_SSL_Cert:
Master_SSL_Cipher:
Master_SSL_Key:
Seconds_Behind_Master: 0
Master_SSL_Verify_Server_Cert: No
Last_IO_Errno: 0
Last_IO_Error:
Last_SQL_Errno: 0
Last_SQL_Error:
Replicate_Ignore_Server_Ids:
Master_Server_Id: 1
Master_UUID: 5fd0428e-79a2-11ec-b336-00155d9ebf27
Master_Info_File: D:\test\data3307\master.info
SQL_Delay: 0
SQL_Remaining_Delay: NULL
Slave_SQL_Running_State: Slave has read all relay log; waiting for more updates
Master_Retry_Count: 86400
Master_Bind:
Last_IO_Error_Timestamp:
Last_SQL_Error_Timestamp:
Master_SSL_Crl:
Master_SSL_Crlpath:
Retrieved_Gtid_Set:
Executed_Gtid_Set:
Auto_Position: 0
Replicate_Rewrite_DB:
Channel_Name:
Master_TLS_Version:
1 row in set (0.00 sec) ERROR:
No query specified

三、升级8.0

1.署mysql8

d:\test\mysql-5.7.35-winx64\bin>D:\test\mysql-8.0.26-winx64\bin\mysqld --install
mysql8_3307 --defaults-file=D:\test\data3306\my.ini
Service successfully installed.

2.停掉原来的

d:\test\mysql-5.7.35-winx64\bin>net stop mysql3307
mysql3307 服务正在停止.
mysql3307 服务已成功停止。

3.修改下配置

[mysqld]
port=3307
character_set_server=utf8
basedir=D:/test/mysql-8.0.26-winx64 #路径改了
datadir=D:/test/data3307
server-id=2
sql_mode=NO_ENGINE_SUBSTITUTION #sql_mode 改了
lower_case_table_names=1
innodb_file_per_table = 1
log_timestamps=SYSTEM log-error = error.log
slow_query_log = 1
slow_query_log_file = slow.log
long_query_time = 5
log-bin = binlog
binlog_format = row
expire_logs_days = 15
log_bin_trust_function_creators = 1 [client]
default-character-set=utf8

4.开启服务,会自动升级

net start mysql8_3307

5.查看日志升级成功了

2022-01-20T17:33:33.598491+08:00 2 [System] [MY-011003] [Server] Finished populating Data Dictionary tables with data.2022-01-20T17:33:37.652733+08:00 5 [System] [MY-013381] [Server] Server upgrade from '50700' to '80026' started.2022-01-20T17:33:53.602051+08:00 5 [System] [MY-013381] [Server] Server upgrade from '50700' to '80026' completed.

Enjoy GreatSQL

文章推荐:

GreatSQL季报(2021.12.26)

https://mp.weixin.qq.com/s/FZ_zSBHflwloHtZ38YJxbA

技术分享|sysbench 压测工具用法浅析

https://mp.weixin.qq.com/s/m16LwXWy9bFt0i99HjbRsw

故障分析 | linux 磁盘io利用率高,分析的正确姿势

https://mp.weixin.qq.com/s/7cu_36jfsjZp1EkVexkojw

技术分享|闪回在MySQL中的实现和改进

https://mp.weixin.qq.com/s/6jepwEE0DnYUpjMYO17VtQ

万答#20,索引下推如何进行数据过滤

https://mp.weixin.qq.com/s/pt6mr3Ge1ya2aa6WlrpIvQ

关于 GreatSQL

GreatSQL是由万里数据库维护的MySQL分支,专注于提升MGR可靠性及性能,支持InnoDB并行查询特性,是适用于金融级应用的MySQL分支版本。

Gitee:

https://gitee.com/GreatSQL/GreatSQL

GitHub:

https://github.com/GreatSQL/GreatSQL

Bilibili:

https://space.bilibili.com/1363850082/video

微信&QQ群:

可搜索添加GreatSQL社区助手微信好友,发送验证信息“加群”加入GreatSQL/MGR交流微信群

QQ群:533341697

微信小助手:wanlidbc

本文由博客一文多发平台 OpenWrite 发布!

Windows环境下部署MySQL主从并模拟升级到8.0的更多相关文章

  1. windows环境下搭建mysql主从

    参考 windows环境下mysql主从配置 1. 环境 参数 说明 主库所在的操作系统 win7 主库的版本 mysql-5.6.46-winx64 主库的ip地址 127.0.0.1 主库的端口 ...

  2. 搭建windows环境下(nginx+mysql+php)开发环境

    搭建windows环境下(nginx+mysql+php)开发环境   1. 所需准备应用程序包        1.1 nginx 程序包nginx-1.0.4.zip或其他版本(下载地址: http ...

  3. Windows系统环境下创建mysql主从数据库方法(双向主从复制)

    创建mysql主从数据库方法(双向主从复制) (一)Windows系统下的MySQL主从复制(单向复制) (1)环境说明: 1,Mysql版本:mysql5.7.20(主从机mysql版本必须一致) ...

  4. 在Windows环境下部署Axis2/C服务

    Apache Axis2/C是C语言实现的网络服务引擎,基于Axis2架构,支持SOAP1.1和SOAP1.2协议,并且支持RESTful风格的Web service. 下面是本人在Windows 7 ...

  5. Windows环境下部署Tomcat服务器图文教程

    Tomcat是一个免费的开放源代码的Web 应用服务器,属于轻量级应用服务器,在中小型系统和并发访问用户不是很多的场合下被普遍使用,是开发和调试JSP程序的首选. 本文将详细介绍在Windows环境下 ...

  6. Django Windows环境下部署

    环境准备 本文将介绍如何在Windows系统上部署Django web项目,本次部署基于下面的架构: Windows10 64位+Python3.6+Django1.11+Apache2.4+mod_ ...

  7. windows环境下使用MySQL导入数据乱码报错的解决办法

    Linux及Mac系统下使用source xxx.sql 可直接导入测试数据(注意必须先切换到当前xxx.sql的目录下), 但在Windows环境下导入会出现乱码报错的情况, 主要是因为编码的问题, ...

  8. 在windows环境下部署nuxt项目(线上发布部署)

    因为公司项目需要兼容SEO,同时我们也一直希望能够真正的实现前后端分离,于是毫不犹豫的选择了nuxt. 话说要重构前后端分离真是一个大工程,由于各种原因我们团队花了近两年时间都没有完成,最近才又重启把 ...

  9. 在Linux环境下部署MySql服务

    之前有下载部署过几次,但是每次都会踩一些坑.特此记录在liunx下部署安装mysql的基本步骤: 1.卸载老版本的mysql find / -name mysql|xargs rm -rf     查 ...

随机推荐

  1. 345. Reverse Vowels of a String - LeetCode

    Question 345. Reverse Vowels of a String Solution 思路:交换元音,第一次遍历,先把出现元音的索引位置记录下来,第二遍遍历元音的索引并替换. Java实 ...

  2. 好客租房16-jsx中的列表渲染

    如果要渲染一组数组 应该使用数组的map方法 注意:渲染列表时候添加key属性 key属性的值要保持唯一 原则:map()遍历谁 就给谁添加key属性 尽量避免索引号作为key //导入react i ...

  3. 好客租房18-jsx阶段总结

    JSX 1jsx是react的核心内容 2jsx是在js代码中写HTML结构,是react中声明式的提现 3使用jsx配合嵌入的js表达式,条件渲染,列表渲染,可以描述任意ui结构 4推荐使用cals ...

  4. [SQLServer]NetCore中将SQLServer数据库备份为Sql脚本

    NetCore中将SQLServer数据库备份为Sql脚本 描述: 最近写项目收到了一个需求, 就是将SQL Server数据库备份为Sql脚本, 如果是My Sql之类的还好说, 但是在网上搜了一大 ...

  5. 【系统问题】windows10打印就蓝屏-报错误代码“win32kfull.sys”

    现象描述: 打印机一打印电脑就蓝屏,蓝屏错误代码为:win32kfull.sys 原因分析: 2021年3月9日-推送了KB5000802补丁更新(操作系统内部版本19041.867和19042.86 ...

  6. 关于我学git这档子事

    创建本地分支并切换到该分支 git checkout -b *** 相当于如下2个命令: git branch *** git checkout *** 推送本地开发分支到远程开发分支 git pus ...

  7. Spring Authorization Server 0.3.0 发布,官方文档正式上线

    基于OAuth2.1的授权服务器Spring Authorization Server 0.3.0今天正式发布,在本次更新中有几大亮点. 文档正式上线 Spring Authorization Ser ...

  8. MySQL锁(乐观锁、悲观锁、多粒度锁)

    锁 并发事务可能出现的情况: 读-读事务并发:此时是没有问题的,读操作不会对记录又任何影响. 写-写事务并发:并发事务相继对相同的记录做出改动,因为写-写并发可能会产生脏写的情况,但是没有一个隔离级别 ...

  9. nginx 部署前端资源的最佳方案

    前言 最近刚来一个运维小伙伴,做线上环境的部署的时候,前端更新资源后,总是需要清缓存才能看到个更新后的结果.客户那边也反馈更新了功能,看不到. 方案 前端小伙伴应该都知道浏览器的缓存策略,协商缓存和强 ...

  10. 【C++函数题目】重载完成Compare函数

    题目来源链接:https://www.dotcpp.com/oj/problem2008.html 题目讲解链接:http://6o2.cn/1yjJB2  题目描述 利用函数重载完成三个比较大小的C ...