Summary of methods for cleaning Mysql general_log

Summary of methods for cleaning Mysql general_log

Method 1:

SET GLOBAL general_log = 'OFF';
RENAME TABLE mysql.general_log TO mysql.general_log2;
DELETE FROM mysql.general_log2;

Note: When DELETE FROM mysql.general_log2 is executed to delete table data, it is found that the operating system data file still exists. You need to manually delete the data file and then continue with the following data operation steps

OPTIMIZE TABLE general_log2;
RENAME TABLE mysql.general_log2 TO mysql.general_log;
SET GLOBAL general_log = 'ON';

This method takes a long time

Method 2:

SET GLOBAL general_log = 'OFF';

Find the general_log file and execute

cat /dev/null > general_log.csv

I found that the size was also released, which was much faster than the previous one.

Method 3:

You can add it to the configuration file my.conf:

general_log=1
general_log_file = '/data/mysql/general_log.CSV'

Put the file on a larger disk

The above is all the knowledge points introduced this time. Thank you for your learning and support for 123WORDPRESS.COM.

You may also be interested in:
  • Detailed explanation of MySQL database binlog cleanup command
  • How to quickly clean up billions of data in MySQL database
  • Code for automatically backing up and cleaning up MySQL database using batch processing
  • How to clean up Alibaba Cloud MySQL space
  • How to completely delete the MySQL service (clean the registry)
  • Two ways to correctly clean up mysql binlog logs
  • How to automatically clean up MySQL binlog logs
  • Shell script automatically backs up MySQL to FTP and regularly cleans up expired backups
  • Analyze the causes and cleanup of fragmentation in MySQL tables
  • PHP data is cleaned before storage. Note that the value range of PHP intval is different from that of MySQL int.
  • How to clean up data in MySQL online database

<<:  A brief talk about JavaScript parasitic composition inheritance

>>:  Linux echo text processing command usage and examples

Recommend

About converting textarea text to html, that is, carriage return and line break

Description: Change the carriage return in the tex...

Creating a file system for ARM development board under Linux

1. Please download the Busybox source code online...

Detailed explanation of mysql basic operation statement commands

1. Connect to MySQL Format: mysql -h host address...

Basic use of subqueries in MySQL

Table of contents 1. Subquery definition 2. Subqu...

Several ways to solve the 1px border problem on mobile devices (5 methods)

This article introduces 5 ways to solve the 1px b...

Introduction to the use of MySQL official performance testing tool mysqlslap

Table of contents Introduction Instructions Actua...

Talk about the understanding of CSS attribute margin

1.What is margin? Margin is used to control the sp...

JS 4 super practical tips to improve development efficiency

Table of contents 1. Short circuit judgment 2. Op...

How to set up the use of Chinese input method in Ubuntu 18.04

In the latest version of Ubuntu, users no longer ...

Detailed explanation of dynamically generated tables using javascript

*Create a page: two input boxes and a button *Cod...

A simple example of using Vue3 routing VueRouter4

routing vue-router4 keeps most of the API unchang...

Creative About Us Web Page Design

Unique “About”-Pages A great way to distinguish yo...

User Experience Summary

Nowadays, whether you are working on software or w...

Network configuration of Host Only+NAT mode under VirtualBox

The network configuration of Host Only+NAT mode u...