- Enter to MySQL/MariaDB server command-line tool (change root with your username and password):
mysql -u root -proot
- Set the general log file path:
SET GLOBAL general_log_file='/var/log/mysql/mycustom.log';
- Set the log output to file format:
SET GLOBAL log_output = 'FILE';
- Enable the server general log:
SET GLOBAL general_log = 'ON';
- Show the general log settings:
SHOW VARIABLES LIKE "general_log%";
-
Try to execute your own SQL query from your app or command-line tool...
-
View the general log file content:
less /var/log/mysql/mycustom.log
- Disable the general server log:
SET GLOBAL general_log = 'OFF';
MariaDB documentation suggests using
1
to enable logging, and0
to disable it. So it should be:Source: https://mariadb.com/kb/en/server-system-variables/#general_log