当前位置:网站首页>MySQL audit log Archive
MySQL audit log Archive
2022-07-05 04:49:00 【Huryer.】
mysqlArchive du Journal de vérification
1、Ouvrir le journal de vérification
# Début de la vérification,InmysqlExécuter les commandes:
set global general_log=on;
set global log_timestamps=SYSTEM;
set global general_log_file='db-1.log';
2、Archive du Journal de vérification
Créer un répertoire de sauvegarde d'archives
# Créer un répertoire de sauvegarde d'archives
mkdir -p /data/backup/audit
cd /data/backup/audit
Créer un script d'archive de journal d'audit
vim mysql_aud_backup.sh
Le contenu du script est le suivant::
#!/bin/bash
# mysqlScript d'archivage du Journal de vérification
# Gardez le plus proche30Journal de vérification quotidien
# crontab -l
# 0 1 * * * nohup sh /data/backup/audit/mysql_aud_backup.sh &
export PATH=.:$PATH:/usr/local/mysql-5.7.34-el7-x86_64/bin
# Définir le chemin du fichier journal
aud_folder=/data/mysql/data
backup_folder=/data/backup/audit
# Spécifiez le nom du fichier du Journal de vérification
fn=db-1.log
dt=$(date +%Y%m%d)
# Passer au chemin du Journal de vérification
cd $aud_folder
# Archiver le journal de vérification
mv $fn $fn.$dt
mysqladmin flush-logs -u root -p'my_sql_pwd'
mv $fn.$dt $backup_folder/
# Réserve30 Journal de vérification dans les jours
find $backup_folder/ -mtime +30 -name "$fn.*" |xargs rm -f
Ajouter des permissions exécutables
# Ajouter des permissions exécutables
chmod +x mysql_aud_backup.sh
3、Ajouter une tâche programmée
# Ajouter une tâche programmée
crontab -e
0 1 * * * nohup sh /data/backup/audit/mysql_aud_backup.sh &
边栏推荐
- 2022 thinking of mathematical modeling C problem of American college students / analysis of 2022 American competition C problem
- Looking at Chinese science and technology from the Winter Olympics: what is the mystery of the high-speed camera that the whole people thank?
- AutoCAD - feature matching
- Official announcement! The third cloud native programming challenge is officially launched!
- Stage experience
- Mode in BST (binary tree & Notes on question brushing)
- Solutions and answers for the 2021 Shenzhen cup
- CSDN body auto generate directory
- [Chongqing Guangdong education] National Open University 2047t commercial bank operation and management reference test in autumn 2018
- Cookie learning diary 1
猜你喜欢
Rip notes [rip message security authentication, increase of rip interface measurement]
Flutter tips: various fancy nesting of listview and pageview
2022 thinking of mathematical modeling C problem of American college students / analysis of 2022 American competition C problem
Managed service network: application architecture evolution in the cloud native Era
Introduction to JVM principle and process
windows下Redis-cluster集群搭建
windows下Redis-cluster集群搭建
程序员应该怎么学数学
【acwing】528. cheese
CUDA Programming atomic operation atomicadd reports error err:msb3721, return code 1
随机推荐
Introduction to JVM principle and process
Manually implement heap sorting -838 Heap sort
【acwing】837. Number of connected block points
Thematic information | carbon, carbon neutrality, low carbon, carbon emissions - 22.1.9
Chapter 6 text processing tools for shell programming (awk)
2021 Higher Education Club Cup mathematical modeling national tournament ABCD problem - problem solving ideas
How can CIOs use business analysis to build business value?
Understand encodefloatrgba and decodefloatrgba
Matplotlib draws three-dimensional scatter and surface graphs
Download the details and sequence of the original data access from the ENA database in EBI
What are the building energy-saving software
Looking at Chinese science and technology from the Winter Olympics: what is the mystery of the high-speed camera that the whole people thank?
中国溶聚丁苯橡胶(SSBR)行业研究与预测报告(2022版)
Pointer function (basic)
windows下Redis-cluster集群搭建
Advanced length of redis -- deletion strategy, master-slave replication, sentinel mode
#775 Div.1 B. Integral Array 数学
SQL set operation
The principle of attention mechanism and its application in seq2seq (bahadanau attention)
Wenet: E2E speech recognition tool for industrial implementation