3.6 Ensure 'general_log_file' Has Appropriate Permissions


MySQL can operate using a variety of log files, each used for different purposes. These are the binary log (which can be encrypted), error log, slow query log, relay log (which can be encrypted), general log, and in the enterprise edition, the audit log (which can be encrypted). Because these are files on the host operating system, they are subject to the permissions and ownership structure provided by the host and may be accessible by users other than the MySQL user. Additionally, using secure key management and at rest MySQL encryption can further protect data from OS users.

Much of the information about the state of MySQL exists in MySQL, the MySQL performance_schema or informations_schema. If you can get the information you need from within MySQL that is more secure as it does not require OS access. If you are not going to use log files it is best to first disable (don't enable) and remove any prior logs.


Limiting the accessibility, or existence, of these log files will protect the confidentiality, integrity, and availability of the MySQL logs.


Changing the permissions of the general log files may impact monitoring tools which use a log file adapter.


If you can, use MySQL SYS, PERFORMANCE_SCHEMA, or MySQL Auditing as these are more secure options.

By default the general_log is disabled (0 or OFF). It's most secure to disable the general_log.

To disable the general_log_file:


If you must use general_log then assure the permissions are correct. Execute the following command for each log file location requiring corrected permissions and ownership:

chmod 600 <general_log_file>
chown mysql:mysql <general_log_file>

Default Value:

The variable general_log is set to OFF by default. The variable general_log_file is set to <host_name>.log by default.

See Also


Item Details


References: 800-53|AC-3, 800-53|AC-5, 800-53|AC-6, 800-53|MP-2, CSCv7|14.6

Plugin: Windows

Control ID: c9675def5333cf2dd0b74c554e818573090b0d12c10c219161a37bcfeee90a66