0

When I create slow_query_log rotation, I need one user for set & update slow_query_log as On and Off. How can I give permission for only this query or global variable access to user?

ajiraj2411
  • 13
  • 4

1 Answers1

0
FLUSH SLOW LOGS;

was added in 5.5.3.

SLOW closes and reopens the slow query log file.

If you are on a *nix OS, first you mv the log file to a new name on the same filesystem (as part of the "rotation" script), then you issue FLUSH .... Through the magic of the way Unix files work, nothing is lost. mysqld continues to write to the old file, even though the name has changed. Then the FLUSH causes mysqld to stop writing to it, and write to a new file. (Windows is another matter.)

You could use mysqladmin instead of mysql.

I would create a new user with the minimal privileges for this action. (I think it is just RELOAD.)

Rick James
  • 135,179
  • 13
  • 127
  • 222