How to enable MySQL logging?




  • Avatar

    Hi, I just tried this on my system - first I followed the instructions in the 5.1 or higher section as I have 5.7 on Plesk Onyx and nothing seemed to be logged so I tried the at runtime instructions and got the following error:

    root@gsl-lxweb:/var/log# touch /var/log/query
    root@gsl-lxweb:/var/log# chown mysql.adm /var/log/query && chmod 640 /var/log/query
    root@gsl-lxweb:/var/log# plesk db "SET GLOBAL general_log_file = '/var/log/query'"
    root@gsl-lxweb:/var/log# plesk db "SET GLOBAL general_log = 'ON'"
    ERROR 29 (HY000) at line 1: File '/var/log/query' not found (Errcode: 13 - Permission denied)
    exit status 1

    ls -l shows the following:

    -rw-r----- 1 mysql             adm             0 Nov  7 13:09 query

  • Avatar
    Alexandr Redikultsev

    Hi Mark,

    I have just checked that on Debian 9 and "5.1 or higher" approach worked for me as expected. Could you provide me with your OS version? In case of Ubuntu, AppArmor might be blocking it.

Please sign in to leave a comment.

Have more questions? Submit a request