adb shell後su無法獲得root許可權 提示no password
阿新 • • 發佈:2021-01-16
文章目錄
1.1 涉及binlog的知識點帶入
01:Binlog會記錄DDL、DCL、DML(除select)、TCL類的SQL語句;
02:row或者mixed模式下操作的dml語句在binlog檔案記錄時中會加密;
且會記錄DML語句具體操作的資料(例如:delete,會記錄刪除前相關的資料),你直接看也是看不到的;
03:statement模式下操作的dml語句在binlog檔案記錄時中不會加密;
- 1
- 2
- 3
- 4
- 5
- 6
1.2 -v -vv及–base64-output之間的區別
######## -v -vv --base64-output單獨使用
-v
# 會顯示dml語句具體做了什麼操作,例如:insert語句,會顯示出insert具體插入了什麼資料;
# 但是看不到完整的dml語句,例如:insert into t1(id) values(1);
# 但還是會看到dml語句的"偽"sql語句,也看不懂;
-vv
# 會顯示dml語句具體做了什麼操作,例如:insert語句,會顯示insert具體插入了什麼資料;
# 且可以看到完整的dml語句,例如:insert into t1(id) values(1);
# 但還是會看到dml語句的"偽"sql語句
--base64-output=decode-rows
# 看不到dml語句的"偽" SQL語句
# 看不到dml語句具體操作了什麼資料
######## -v -vv --base64-output結合使用
-v --base64-output=decode-rows
# 看得到dml語句具體做了什麼操作(例如:insert時具體插入了什麼資料)
# 看不到dml語句的完整sql語句(例如:insert into t1(id) values(1);)
# 看不到dml語句的"偽"sql語句
-vv --base64-output=decode-rows
# 看得到dml語句具體做了什麼操作(例如:insert時具體插入了什麼資料)
# 看得到dml語句的完整sql語句(例如:insert into t1(id) values(1);),但是被註釋掉了的;
# 看不到dml語句的"偽"sql語句
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
1.3 測試環境說明
當前MySQL的版本已更新8.X.X了哈,從mysql 5.6開啟只要一開啟binlog,預設的binlog模式就是row模式了。
######## 資料庫的版本
mysql> select @@version;
+------------+
| @@version |
+------------+
| 5.7.28-log |
+------------+
1 row in set (0.00 sec)
######## binlog的相關資訊
-- binlog的狀態、存放路徑/檔名字首
mysql> select @@global.log_bin,@@log_bin_basename;
+------------------+--------------------------------------+
| @@global.log_bin | @@log_bin_basename |
+------------------+--------------------------------------+
| 1 | /mysql/logs/3306/binlog/21_mysql_bin |
+------------------+--------------------------------------+
1 row in set (0.00 sec)
-- binlog的模式
mysql> select @@global.binlog_format;
+------------------------+
| @@global.binlog_format |
+------------------------+
| ROW |
+------------------------+
1 row in set (0.00 sec)
-- 當前binlog的使用情況
mysql> show master status;
+---------------------+----------+--------------+------------------+-------------------+
| File | Position | Binlog_Do_DB | Binlog_Ignore_DB | Executed_Gtid_Set |
+---------------------+----------+--------------+------------------+-------------------+
| 21_mysql_bin.000001 | 154 | | | |
+---------------------+----------+--------------+------------------+-------------------+
1 row in set (0.00 sec)
-- 作業系統下看binlog檔案
mysql> system ls -l /mysql/logs/3306/binlog/21_mysql_bin.000001
-rw-r----- 1 mysql mysql 154 5月 21 22:00 /mysql/logs/3306/binlog/21_mysql_bin.000001
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
- 29
- 30
- 31
- 32
- 33
- 34
- 35
- 36
- 37
- 38
- 39
- 40
- 41
- 42
1.4 測試資料準備
######## 建立chenliang庫後進入到庫下,並檢視是否成功進入
create database if not exists chenliang character set utf8 collate utf8_general_ci;
use chenliang;
select database();
######## 建立test1表並插入資料
-- 建立t1表
create table if not exists t1(
id int unsigned auto_increment comment"序列",
name varchar(30) not null comment"姓名",
sex enum("男","女") not null comment"性別",
age tinyint unsigned not null comment"年齡",
primary key(id)
)engine=innodb character set utf8 collate utf8_general_ci comment"測試表1";
-- 往t1表中插入幾條資料並提交
insert into t1(name,sex,age) values
("chenliang01","男",21),
("chenliang02","男",22),
("chenliang03","男",23),
("chenliang04","女",24),
("chenliang05","女",25),
("chenliang06","女",25);
commit;
-- 檢視t1表中的資料
mysql> select * from t1;
+----+-------------+-----+-----+
| id | name | sex | age |
+----+-------------+-----+-----+
| 1 | chenliang01 | 男 | 21 |
| 2 | chenliang02 | 男 | 22 |
| 3 | chenliang03 | 男 | 23 |
| 4 | chenliang04 | 女 | 24 |
| 5 | chenliang05 | 女 | 25 |
| 6 | chenliang06 | 女 | 25 |
+----+-------------+-----+-----+
6 rows in set (0.00 sec)
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
- 29
- 30
- 31
- 32
- 33
- 34
- 35
- 36
- 37
- 38
1.5 找出insert語句的post點
為了後面儘量的少輸出文字,我們找到1.4章節中對於insert這條語句(完整事務)的起止pos點;
1.6 不用-v -vv --base64-output引數
命令
mysqlbinlog --start-position=845 --stop-position=1438 /mysql/logs/3306/binlog/21_mysql_bin.000001
- 1
截圖示記說明
1.7 用-v引數來看
命令
mysqlbinlog -v --start-position=845 --stop-position=1438 /mysql/logs/3306/binlog/21_mysql_bin.000001
- 1
相關截圖
1.8 用-vv引數來看
命令
mysqlbinlog -vv --start-position=845 --stop-position=1438 /mysql/logs/3306/binlog/21_mysql_bin.000001
- 1
相關截圖說明
1.9 用–base-64-output引數來看
命令
mysqlbinlog --base64-output=decode-rows --start-position=845 --stop-position=1438 /mysql/logs/3306/binlog/21_mysql_bin.000001
- 1
相關截圖說明
1.10 用-vv配合–base64-output來看
命令
mysqlbinlog -vv --base64-output=decode-rows --start-position=845 --stop-position=1438 /mysql/logs/3306/binlog/21_mysql_bin.000001
- 1
相關截圖說明