I need to run mysql servers on linux (ubuntu 24) and have them log to stderr.
It is possible to pass the argument --log-error
to instruct mysqld where to write error logs to, but if I pass --log-error=/dev/stderr
, mysql appends .err resulting in --log-error=/dev/stderr.err
, and then it tries to log into a file in the data directory instead of to stderr.
if I don’t pass --log-error
at all, mysql is supposed to log to stderr, which it does, but, it relies on a file path to exist, and aborts if it doesn’t:
[Server] Could not open file '/var/log/mysql/error.log' for error logging: Permission denied
I cannot create /var/log/mysql
or give it the needed permissions (there will be multiple mysqlds running at once owned by different users, so if I were to do this, I’d need to specify a different log file per one in different paths)
Is there no way to make mysqld log to stderr without depending on /var/log/mysql
?
2
If log-error is empty it goes to stderr.
On systemd based services this is a good default as it will end up in the journal, accessible via journalctl -u mysql.service
3