For MariaDB 10.x and later, set the following variables in a MySQL admin session, typically either via phpMyAdmin or from the MySQL command line client:
- SET GLOBAL log_output = 'TABLE'; (to make sure logs go where you can see them)
- SET GLOBAL general_log = 'ON'; (to enable the general log)
- SET GLOBAL slow_query_log = 'ON'; (to enable the slow query log)
You can enable either or both of the log files, depending on your needs.
After taking these steps, log contents will be in the mysql.general_log and mysql.slow_log tables; no restart is required. Please see the MariaDB documentation for full details.
When you are finished, make sure to disable logging again, and truncate the log files to save space and cost:
- SET GLOBAL general_log = 'OFF';
- SET GLOBAL slow_query_log = 'OFF';
- TRUNCATE TABLE mysql.general_log;
- TRUNCATE TABLE mysql.slow_log;
For MariaDB 5.x, logging to tables is not supported. If you have an older process, consider upgrading, but in the mean time:
- Visit the MySQL panel of our member interface.
- Select the name of the relevant process to get to its MySQL Process Information panel.
- In the Actions box in the upper right, choose "Edit MySQL Settings."
- Enable the desired logs.
- Save the settings.
- Restart the process.
- Perform the activity you wish to log.
- Disable the logs.
- Request log retrieval using this assistance request.
On 5.x, when we retrieve logs, they will be removed and the process will be restarted.