0

I have a cPanel, Centos 7 webserver using MySQL 5.6, in which I am trying to output the MySQL general log to a named pipe I have created. I have not had any issues creating the pipe and can write to other replacement log files in the MySQL directory without issues.

However when I create a named pipe and set this as the log file (How do I output MySQL logs to syslog?) I get this error in my errorlog on a restart:

[ERROR] Could not open /var/lib/mysql/server1.log for logging (error 2). Turning logging off for the whole duration of the MySQL server process. To turn it on again: fix the cause, shutdown the MySQL server and restart it.

I have set the owner and group of the named pipe to the mysql user and the permissions to 660 (and even 777 to be sure). These same permissions seem to work fine for a normal log file.

Any suggestions as to what I have done wrong?

0

Every step in /var/lib/ needs to have at least 755 permissions. That is, each directory needs to be readable and x (searchable) by user mysql. (Technically, none of those steps should be owned by mysql, so 005 is sufficient. However, you may find 750, which won't work.)

/var/lib/mysql/, itself needs to be owned and writable by mysql (700 or better).

  • Hi the permissions seem to work ok, the error log seems to write to a named pipe fine, it just seems to be the general log that gets the error – WiddleWabbit Feb 22 '18 at 1:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.