当前位置:网站首页>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 &
边栏推荐
- Inline built-in function
- Introduction to JVM principle and process
- Discussion on the dimension of confrontation subspace
- English topic assignment (26)
- #775 Div.1 B. Integral Array 数学
- 【acwing】240. food chain
- Is there a sudden failure on the line? How to make emergency diagnosis, troubleshooting and recovery
- Special information | finance, accounting, audit - 22.1.23
- 2021 huashubei mathematical modeling idea + reference + paper
- 2021 higher education social cup mathematical modeling national tournament ABCD questions - problem solving ideas - Mathematical Modeling
猜你喜欢
XSS injection
AutoCAD - scaling
Uncover the seven quirky brain circuits necessary for technology leaders
Observable time series data downsampling practice in Prometheus
2022-2028 global and Chinese virtual data storage Market Research Report
Label exchange experiment
【acwing】528. cheese
[groovy] closure (closure call is associated with call method | call () method is defined in interface | call () method is defined in class | code example)
Reading and visualization of DICOM, MHD and raw files in medical imaging
Minor spanning tree
随机推荐
Flutter tips: various fancy nesting of listview and pageview
程序员应该怎么学数学
2021 electrician cup (the 12th "China Society of electrical engineering Cup" National Undergraduate electrician mathematical modeling) detailed ideas + codes + references
Private collection project practice sharing [Yugong series] February 2022 U3D full stack class 006 unity toolbar
What are the building energy-saving software
windows下Redis-cluster集群搭建
PostgreSQL 超越 MySQL,“世界上最好的编程语言”薪水偏低
【acwing】240. food chain
Observable time series data downsampling practice in Prometheus
Setting up redis cluster cluster under Windows
How should programmers learn mathematics
49 pictures and 26 questions explain in detail what is WiFi?
AutoCAD - isometric annotation
Scope of package class package
Thematic information | carbon, carbon neutrality, low carbon, carbon emissions - 22.1.9
Mode in BST (binary tree & Notes on question brushing)
Leetcode hot topic Hot 100 day 33: "subset"
Invalid bound statement (not found) in idea -- problem solving
[groovy] closure (Introduction to closure class closure | this, owner, delegate member assignment and source code analysis)
Debug insights