mysql - MySQL 可以在任何场景下自动执行 Alter User 查询吗?
问题描述
我在 MySQL 中启用了 5 个节点的组复制,一切正常。
当我今天检查时,有 2 个节点出现问题,并且由于以下类似错误,两个节点都无法连接到组:
This member has more executed transactions than those present in the group. Local transactions: 648066b4-3642-476c-be1a-5a4b98248ee4:1-822137:1000009-1111095:2000379-2000583, b1cabb95-ed59-11eb-abb6-3c7c3f0f812c:1, f0d5216c-e46e-11eb-9d58-04d9f57da18c:1-76 > Group transactions: 648066b4-3642-476c-be1a-5a4b98248ee4:1-822137:1000009-1114518:2000379-2000583, f0d5216c-e46e-11eb-9d58-04d9f57da18c:1-76
以前我也经常遇到同样的错误。但是我曾经再次重新安装 mysql 并添加到组而不检查运行的查询。
今天,在阅读本文时,我发现以下查询在两个节点中都执行了,因为哪些节点有更多事务:
+---------------+-----+----------------+-----------+-------------+--------------------------------------------------------------------------------------+
| Log_name | Pos | Event_type | Server_id | End_log_pos | Info |
+---------------+-----+----------------+-----------+-------------+--------------------------------------------------------------------------------------+
| binlog.000012 | 4 | Format_desc | 3 | 125 | Server ver: 8.0.26-0ubuntu0.20.04.2, Binlog ver: 4 |
| binlog.000012 | 125 | Previous_gtids | 3 | 224 | 648066b4-3642-476c-be1a-5a4b98248ee4:674241-822137:1101529-1111078:2000579-2000583 |
| binlog.000012 | 224 | Gtid | 3 | 297 | SET @@SESSION.GTID_NEXT= '1234903d-ed59-11eb-8671-74d4352beb24:1' |
| binlog.000012 | 297 | Query | 3 | 440 | use `mysql`; ALTER USER 'root'@'localhost' IDENTIFIED WITH 'auth_socket' /* xid=3 */ |
+---------------+-----+----------------+-----------+-------------+--------------------------------------------------------------------------------------+
由于这 5 个节点都是由我管理的多个家庭网络中的本地节点。
- 我的网络或服务器是否存在漏洞,导致其他人运行了 alter 命令?
- 还是这个命令是 MySQL 自动执行的?
目前mysql_secure_installation
没有在任何节点执行,因此mysql
root用户无需密码即可直接访问。
- 我想知道如果我
w
每秒将命令日志保存到一个文件中,以查看全天登录的用户,这会有帮助吗?
在这种情况下我应该怎么做?
解决方案
推荐阅读
- sql - Storing a range of months in an SQL table
- visual-studio-code - How to run multiple VS Code instances to use different identities for interacting with a remote git repository while working with Remote Containers?
- python - Installing python 3.6 on mac along with pip
- xamarin - Identitty4 Access Token from Android and token lenght
- node.js - I keep getting "Unexpected end of JSON input"
- c# - How to read the custom configuration settings in c#?
- vb.net - 如何使用 devexpress 根据某些列值更改行颜色?
- php - PHP string replace not working as expected
- c - Eclipse c 格式化程序 | 在函数头中保留 arg-type 和 arg-name 之间的空格
- php - 在字符串中查找并替换