Home >Database >Mysql Tutorial >Related operations of mysql general log
Mysql After opening the general log, all query statements will be recorded in the general log file. The file is read-only, but the general log file will be very large, so it is closed by default.
But sometimes you need to check for errors and other reasons, and you need to open the general log temporarily.
Opening method:
show global variables like '%general%'; set global general_log = on; // 打开 set global general_log = off; // 关闭
##general log defaults to recording to a text file, but You can change the records to the database by modifying
log_output='TABLE', and a table general_log will be added to the 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,The engine of the table should be modified to myisam to improve performance.
set global general_log = off; alter table general_log engine = myisam; set global general_log = on;This article explains the related operations of mysql general log. For more related content, please pay attention to the PHP Chinese website.
Introduction to the php Cookies operation class
Introduction to the php password generation class
Introduction to the mutual communication between php main and iframe (same domain/cross domain)
The above is the detailed content of Related operations of mysql general log. For more information, please follow other related articles on the PHP Chinese website!