MariaDB How to enable General Query Log
Last updated: May 28, 2022
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.
- Checking the status of General Query Log.
- Enable General Query Log.
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%';
- 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;
And of course, let's add variables to the configuration file.
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.