MariaDB How to enable General Query Log

  • Last update: Apr 3, 2024
  • Views: 29
  • Author: Admin
MariaDB How to enable General Query Log

Colleagues hello to all.

In today's article, I want to tell you about such a thing as the general query log (General Query Log) in MariaDB. Absolutely everything that enters the database is written to this log. General Query Log is very similar to Binary Log, but there is one important difference. In the binary log the query is logged only when the transaction is committed by the server, while in the general query log it is logged immediately after it is received by the server.

 

Article content:

  1. Checking the status of General Query Log.
  2. Enable General Query Log.
  3. Result.

 

1. Checking the status of the General Query Log.

By default, General Query Log is disabled on the server. To check this, let's use the command.

mariadb> SHOW VARIABLES LIKE '%general%';

mariadb_general_log

  • general_log - OFF log disabled, ON log enabled.
  • general_log_file - Log name

 

2. Enable General Query Log.

The variables responsible for enabling General Query Log are dynamic, so we can enable General Query Log in the console via the SET GLOBAL command.

mariadb> SET GLOBAL general_log_file = '/mariadb/log/general_log_query.log';

mariadb> SET GLOBAL general_log = ON;

mariadb_general_log

mariadb_general_log

And of course, let's add variables to the configuration file.


 

3. Result.

mariadb_general_log

An example of the data that the database writes to a file.


 

Thank you all, I hope that my article helped you in some way.

SIMILAR ARTICLES