After trying to activate MySQL slow query mode provided by the user manual (http://dev.mysql.com/doc/refman/5.7/en/server-system-variables.html#sysvar_slow_query_log_file) and other answers (How do I enable the MySQL slow query log?) , they all fail for different error messages:
(1) mysql -h ${SERVER_NAME} -B -N -P ${PORT_NAME} -u ${USER_NAME} --password=${PASSWORD} -e "
set global slow_query_log = 'ON';
SET global slow_query_log_file=$HOME/slow-query-log-CLIENT-${CLIENT_ID}-YEARLY-${Local_time}.log;
SELECT * FROM WHATEVER;"
ERROR 1227 (42000) at line 3: Access denied; you need (at least one of) the SUPER privilege(s) for this operation
(2) mysql -h ${SERVER_NAME} -B -N -P ${PORT_NAME} -u ${USER_NAME} --password=${PASSWORD} -e "
set global slow_query_log = 'ON';
SET global slow_query_log_file=$HOME/slow-query-log-CLIENT-${CLIENT_ID}-YEARLY-${Local_time}.log;
SET global log_output=/home/user;
ERROR 1227 (42000) at line 3: Access denied; you need (at least one of) the SUPER privilege(s) for this operation
(3) When I follow the MySQL user manual for the command line option, the following error message pops out:
mysql -h ${SERVER_NAME} -B -N -P ${PORT_NAME} -u ${USER_NAME} --password=${PASSWORD} -e --slow_query_log --slow_query_log_file=SLOW-CLIENT-${CLIENT_ID}-${Local_time} --global log_output=/home/user "
mysql: unknown variable 'slow_query_log_file='
Quite frustrating. Could any guru enlighten?