当前位置:网站首页>Mysqldump full recovery to another new instance, and then perform flush privileges analysis
Mysqldump full recovery to another new instance, and then perform flush privileges analysis
2022-07-19 09:25:00 【51CTO】
Preparation before experiment
mysql 1: Express mysql Example 1
mysql 2: Table is mysql Example 2
If mysqldump One library is available , A new instance is created 2, example 2 Besides root Users have no other users , however root The passwords are different , that mysql.user Can you recover successfully , perform flush privileges What's going to happen .
mysqldump be completely ready
mysql 1:root password 123456, Perform a full backup
mysql 2:root password 234567
Full recovery
mysql 2: After logging in
source /tmp/all.sql To succeed
mysql 2:mysql.user Tables are also updated
Resume exception analysis
sign out mysql 2, Log in again , Password error found , Use mysql 1 Of root password , Login successful
Analysis conclusion
Use full recovery to restore to a new instance , Because backup mysql.user surface
flush privileges Will overwrite the current database mysql 2 Passwords and permissions , Turn into mysql 1 Password and permissions
flush privileges When was it used , When the permission data in the data table is inconsistent with the permission data in memory ,
Can be used to rebuild memory data , Get to a consistent state .
flush privileges The command will clear acl_users Array , And then from mysql.user Read data from the table and reload ,
Reconstruct a acl_users Array . in other words , The data in the data sheet shall prevail , The global permission memory array will be reloaded .
therefore ,mysql.user The execution of the flush privileges It can be recovered later .
Add
mysql The permissions of are determined by mysql.user Tables and memory arrays acl_users control
mysql The connection between the client and the server will be assigned a thread , By memory acl_users Array control , Check the permissions of this user from the array in memory , And copy the permission value to the thread object . Therefore, the situation shown above will occur , The new instance imports mysql.user surface , But the new instance can still use its original root Password to login , But once flush privileges, The memory array is reloaded , Then the password permission will be overwritten .
边栏推荐
- un7.16:如何在码云上部署项目并邀请组员?
- L1-088 静静的推荐(测试点1)
- DuiLib 实现tooltip自定义鼠标提示窗口
- Questions d'entrevue - concevoir des cas d'essai pour:: memcpy
- OpenCV模板
- Day 7 Training
- Flink small knowledge -- configuration of task scheduling slots slotsharinggroup
- 第一部分—C语言基础篇_6. 函数
- uniapp仓库管理系统源码
- Un7.16: how to deploy projects on code cloud and invite team members?
猜你喜欢
企业数字化转型,为何 SaaS 模式如此重要?
第一部分—C语言基础篇_3. 运算符与表达式
[troubleshooting] common problems and solutions when installing MySQL in Windows system
Yanrong technology was selected as Beijing's "specialized and innovative" in 2022 to lead hybrid cloud file storage
案例分享 | 基于Linkis+DSS构建合合信息一站式数据开发平台
Data Lake (20): Flink is compatible with iceberg, which is currently insufficient, and iceberg is compared with Hudi
SAP Fiori 的附件处理(Attachment handling)
Markdown (5): anchor link
Flink small knowledge -- configuration of task scheduling slots slotsharinggroup
【C语言】指针练习题2——笔试真题及解析
随机推荐
在Pycharm里面如何避免全局索引?如何取消对于某个文件夹的索引?
企业数字化转型,为何 SaaS 模式如此重要?
Markdown (5): anchor link
AcWing 257. 关押罪犯 题解(二分图)
Fundamentals of C language -- 2-2 const keywords and pointers
KNN分類器
【微服务~高级】配置中心实战
C# 读写文本,生成二维码
MySQL 用户管理
Classificateur knn
ETCD数据库源码分析——etcdserver bootstrap从快照中恢复store
每日模型系列:2022.07.11
C语言基础篇 —— 2-2 const关键字与指针
ETCD数据库源码分析——初始化EtcdServer结构体
【论文笔记】基于深度学习的视觉检测及抓取方法
Anycontrol demo demo demo
L1-088 静静的推荐(测试点1)
开发实用工具
【愚公系列】2022年7月 Go教学课程 012-强制类型转换
C语言力扣第25题之k个一组反转链表。多指针遍历