mysql主从搭建之诡异事件
今天在搭建主从后出现了主库system账号丢失INSERT权限的情况,记录如下
主库:
system账号权限同root权限,并且mysql库已经删除
从库:
mysql库存在,无system账号
主从同步搭建完成后,start slave开启同步,返回主库测试,发现可以建表,但是不能插入数据,查看system用户权限如下
mysql> select * from user where user='system'\G;
*************************** 1. row ***************************
Host: localhost
User: system
Password: *6BB4837EB74329105EE4568DDA7DC67ED2CA2AD9
Select_priv: Y
Insert_priv: N
Update_priv: Y
Delete_priv: Y
Create_priv: Y
Drop_priv: Y
Reload_priv: Y
Shutdown_priv: Y
Process_priv: Y
File_priv: Y
Grant_priv: Y
References_priv: Y
Index_priv: Y
Alter_priv: Y
Show_db_priv: Y
Super_priv: Y
Create_tmp_table_priv: Y
Lock_tables_priv: Y
Execute_priv: Y
Repl_slave_priv: Y
Repl_client_priv: Y
Create_view_priv: Y
Show_view_priv: Y
Create_routine_priv: Y
Alter_routine_priv: Y
Create_user_priv: Y
Event_priv: Y
Trigger_priv: Y
Create_tablespace_priv: Y
ssl_type:
ssl_cipher:
x509_issuer:
x509_subject:
max_questions: 0
max_updates: 0
max_connections: 0
max_user_connections: 0
plugin: mysql_native_password
authentication_string:
password_expired: N
1 row in set (0.00 sec)
可以看到system具有更新的权限,遂做如下处理:
mysql> update user set Insert_priv='Y' where user='system';
Query OK, 1 row affected (0.00 sec)
Rows matched: 1 Changed: 1 Warnings: 0
mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)
保险起见,重启mysql
[root@HadoopDEV1 3306]# ./mysql stop
Mysqldstoping......
[1]+ 完成 mysqld_safe --defaults-file=/data/3306/my.cnf --skip-grant-tables 2>&1 > /dev/null
[root@HadoopDEV1 3306]# ./mysql start
Mysqldstarting......
[root@HadoopDEV1 3306]# mysql -usystem -p -S /data/3306/data/mysql.sock
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 1
Server version: 5.6.15-log MySQL Community Server (GPL)
Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
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.
再次查看system用户权限
mysql> select * from mysql.user where user='system'\G;
*************************** 1. row ***************************
Host: localhost
User: system
Password: *6BB4837EB74329105EE4568DDA7DC67ED2CA2AD9
Select_priv: Y
Insert_priv: Y
Update_priv: Y
Delete_priv: Y
Create_priv: Y
Drop_priv: Y
Reload_priv: Y
Shutdown_priv: Y
Process_priv: Y
File_priv: Y
Grant_priv: Y
References_priv: Y
Index_priv: Y
Alter_priv: Y
Show_db_priv: Y
Super_priv: Y
Create_tmp_table_priv: Y
Lock_tables_priv: Y
Execute_priv: Y
Repl_slave_priv: Y
Repl_client_priv: Y
Create_view_priv: Y
Show_view_priv: Y
Create_routine_priv: Y
Alter_routine_priv: Y
Create_user_priv: Y
Event_priv: Y
Trigger_priv: Y
Create_tablespace_priv: Y
ssl_type:
ssl_cipher:
x509_issuer:
x509_subject:
max_questions: 0
max_updates: 0
max_connections: 0
max_user_connections: 0
plugin: mysql_native_password
authentication_string:
password_expired: N
1 row in set (0.00 sec)
插入数据测试:
mysql> select * from t;
Empty set (0.00 sec)
mysql> insert into t values(2);
Query OK, 1 row affected (0.01 sec)
mysql> select * from t;
+------+
| id |
+------+
| 2 |
+------+
1 row in set (0.00 sec)
测试插入正常,对于具体原因尚不得知
mysql主从搭建之诡异事件的更多相关文章
- ### MySQL主从搭建Position
一.MySQL主从搭建 搭建主从架构的MySQL常用的有两种实现方式: 基于binlog的fileName + postion模式完成主从同步. 基于gtid完成主从同步搭建. 本篇就介绍如何使用第一 ...
- mysql 主从搭建步骤
mysql 主从搭建步骤 1:主库开启master端bin-log 2:主库创建备份用户 3:主库全备 4:从库导入全备数据 5:从库修改change master to信息 6:从库slave st ...
- SQL Server、MySQL主从搭建,EF Core读写分离代码实现
一.SQL Server的主从复制搭建 1.1.SQL Server主从复制结构图 SQL Server的主从通过发布订阅来实现 1.2.基于SQL Server2016实现主从 新建一个主库&quo ...
- MySQL主从搭建
主服务器配置 1.编辑配置文件 # 如果不存在,就手动创建一个 vim /etc/my.cnf 在配置文件加入如下值: [mysqld] # 唯一的服务辨识号,数值位于 1 到 2^32-1之间. # ...
- MySql主从搭建详细步骤
环境: linux64位,一台机器两个实例,主库3306端口,从库3307端口 步骤: 一.下载安装 先下载安装mysql,这里使用了5.7.21版本,具体过程不做详细说明,可自行查资料如何下载 二. ...
- mysql主从搭建操作
1.搭建说明准备工作:主从库已安装mysql软件以及xtracbackup备份工具.具体操作可参见mysql rpm安装文档. 介质 版本操作系统 Red Hat Enterprise Linux S ...
- mysql 主从搭建
主要搭建步骤如下: 1.打开binlog,设置server_id 打开主库的--log-bin,并设置server_id 2.主库授权 --最好也在从库对主库授权 ...
- MariaDB(Mysql)-主从搭建
卸载过程: 停止服务:systemctl stop mariadb 查询安装包:rpm -qa | grep mariadb 卸载: rpm -e mariadb-server rpm -e mari ...
- 电商平台--Mysql主从搭建(2)
Master上授权从库: ```grant replication slave on *.* to slave1@ip identified by 'password';``` 基于数据库hotcop ...
随机推荐
- windows下的gvim和emmet 下载和安装 + "omnifunc is not set" solution?
注意几个地方: 引导键是ctrl-y, 其他就是实际的操作键了, 如: n下一个插入点, N是上一个插入点(不是p), ctrl-y + i是自动为图片添加宽度和高度尺寸, 要点是要把光标移动到 im ...
- Large Division(大数)题解
Given two integers, a and b, you should check whether a is divisible by b or not. We know that an in ...
- perl入门知识(3)
引用 在很多场合下使用引用传值,能在很大程度上提高代码的运行效率. 定义一个引用在变量名前加”\”就可以了,如: $ra=\$a; $rb=\@b; ...
- Unity3D学习笔记(三):V3、运动、帧率、OnGUI
盯着看:盯住一个点 transform.LookAt(Vector3 worldPosition); using System.Collections; using System.Collection ...
- python从字符串解析方法名
方法如下 import requests func_name = 'get' fn_obj = getattr(requests,func_name) fn_obj('http://www.baidu ...
- HDU 5834 Magic boy Bi Luo with his excited tree(树形dp)
http://acm.hdu.edu.cn/showproblem.php?pid=5834 题意: 一棵树上每个节点有一个价值$Vi$,每个节点只能获得一次,每走一次一条边要花费$Ci$,问从各个节 ...
- NOI 4978 宠物小精灵之收服(二维背包)
http://noi.openjudge.cn/ch0206/4978/ 描述 宠物小精灵是一部讲述小智和他的搭档皮卡丘一起冒险的故事. 一天,小智和皮卡丘来到了小精灵狩猎场,里面有很多珍贵的野生宠物 ...
- codeforces 766E Mahmoud and a xor trip
题目链接:http://codeforces.com/problemset/problem/766/E 大意,给出一个$n$个点的树,每个点都有一个权值,令$Disx$为$u$到$v$路径上的异或和求 ...
- Codeforces Round #323 (Div. 2) C. GCD Table map
题目链接:http://codeforces.com/contest/583/problem/C C. GCD Table time limit per test 2 seconds memory l ...
- Codeforces D - Ithea Plays With Chtholly
D - Ithea Plays With Chtholly 思路:考虑每个位置最多被替换c/2次 那么折半考虑,如果小于c/2,从左往右替换,大于c/2总右往左替换,只有小于这个数(从左往右)或者大于 ...