当前位置:网站首页>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 &
边栏推荐
- Neural networks and deep learning Chapter 5: convolutional neural networks reading questions
- Rip notes [rip three timers, the role of horizontal segmentation, rip automatic summary, and the role of network]
- windows下Redis-cluster集群搭建
- Cookie learning diary 1
- Decryption function calculates "task state and lifecycle management" of asynchronous task capability
- WeNet:面向工业落地的E2E语音识别工具
- Flutter tips: various fancy nesting of listview and pageview
- 中国AS树脂市场调研与投资预测报告(2022版)
- Label exchange experiment
- Special information | real estate and office buildings - 22.1.9
猜你喜欢
次小生成树
质量体系建设之路的分分合合
[groovy] closure (closure as function parameter | code example)
AutoCAD - lengthening
[groovy] closure (closure parameter binding | curry function | rcurry function | ncurry function | code example)
SQL set operation
Raki's notes on reading paper: soft gazetteers for low resource named entity recognition
Key review route of probability theory and mathematical statistics examination
10 programming habits that web developers should develop
[goweb development] Introduction to authentication modes based on cookies, sessions and JWT tokens
随机推荐
Introduction to JVM principle and process
Autocad-- Real Time zoom
Understand encodefloatrgba and decodefloatrgba
中国金刚烷行业研究与投资预测报告(2022版)
Download the details and sequence of the original data access from the ENA database in EBI
Wenet: E2E speech recognition tool for industrial implementation
Data security -- 14 -- Analysis of privacy protection governance
History of web page requests
#775 Div.1 C. Tyler and Strings 组合数学
Group counting notes (1) - check code, original complement multiplication and division calculation, floating point calculation
2021 electrician cup idea + code - photovoltaic building integration plate index development trend analysis and prediction: prediction planning issues
Looking at Chinese science and technology from the Winter Olympics: what is the mystery of the high-speed camera that the whole people thank?
The first topic of ape Anthropology
介绍汉明距离及计算示例
Flutter tips: various fancy nesting of listview and pageview
Official announcement! The third cloud native programming challenge is officially launched!
QT Bluetooth: a class for searching Bluetooth devices -- qbluetooth devicediscoveryagent
AutoCAD -- dimension break
Neural networks and deep learning Chapter 4: feedforward neural networks reading questions
【Leetcode】1352. 最后 K 个数的乘积