Get the App
SLTechnology News&Howtos  ›  Database  › 

Handouts for operating mysql general log

Shulou Source: shulou.com Published: 2022-06-01 20:46:42 10月03日 Update

The following content mainly brings you the relevant handouts on the operation of mysql general log. The knowledge mentioned here, which is slightly different from books, is summarized by professional and technical personnel in the process of contact with users, and has a certain value of experience sharing. I hope to bring help to the majority of readers.

When mysql opens general log, all queries will be recorded in the general log file, which is read-only, but the general log file will be very large, so it is turned off by default.

But sometimes need to check errors and other reasons, temporarily need to open general log.

Open method:

Show global variables like'% general%';set global general_log = on; / / Open set global general_log = off; / / close

General log is recorded to a text file by default, but changes can be recorded to the database by modifying log_output='TABLE', and a table general_log is added to mysql db.

By looking at the table structure, it is an external csv file.

Show global variables like'% log_output%';set global log_output = 'TABLE';use mysql;show create table general_log\ G

Because the general_log table is an external csv file, the performance of querying this table is low, and the engine of the table should be changed to myisam to improve performance.

Set global general_log = off;alter table general_log engine = myisam;set global general_log = on

These are the details about the operation of mysql general log, please pay attention to other related articles!

Tags: Files content performance queries handouts different the following majors books people values reasons can be passed that is engines technology data databases texts articles Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Xiaomi Microsoft macOS MySQL Redmi