Home > Database > Mysql Tutorial > Related operations of mysql general log

Related operations of mysql general log

jacklove
Release: 2018-06-09 14:39:28
Original
1816 people have browsed it

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; // 关闭
Copy after login

##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
Copy after login


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;
Copy after login
This article explains the related operations of mysql general log. For more related content, please pay attention to the PHP Chinese website.


Related recommendations:

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!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template