MySQL file locations and log

Posted under » MySQL » Ubuntu updated on 29 July 2020

Sometime, you want to change your configuration, like making mysql use memory or receive this error "The MySQL server has gone away (error 2006)". Then you need to change your config.

set max_allowed_packet = 128M

Though it is not advisable to log mysql, it is useful if you want to troubleshoot by specifying at the config.

[mysqld]
general_log_file        = /var/log/mysql/query.log
general_log             = 1

Just make sure the permissions are correct

Applies to Ubuntu 20.04

Applies to CentOS 7

this is where the databases are located.

However, in some cases, you might want to put it elsewhere or make it portable.

web security linux ubuntu python django git Raspberry apache mysql php drupal cake javascript css AWS data