Search code examples
mysqlreplicationmysql-slow-query-log

Can you enable Log Query on MySQL Replication Server?


On a replication server running MySQL 5.1.73, I enabled general and slow log queries. Yet nothing is logging to the log file after I restarted the server. I've googled the problem and I've seen "hints" that you cannot enable query logging on a replication server. Can anybody confirm if this is true?

Thanks,


Solution

  • I found out that you MUST list the logging configs under [mysqld] in the /etc/my.cnf file. If you just place them willy-nilly in the config file (at the bottom is what I did) your logging won't be enabled.

    [mysqld] general_log=1

    general_log_file=/var/log/mysqld.log

    slow-query-log=1

    slow-query-log-file=/var/log/mysqld.log

    long_query_time=1