"If a worker wants to do his job well, he must first sharpen his tools." - Confucius, "The Analects of Confucius. Lu Linggong"
Front page > Programming > How Can I Enable and Disable MySQL Query Auditing for One Hour?

How Can I Enable and Disable MySQL Query Auditing for One Hour?

Published on 2024-12-21
Browse:980

How Can I Enable and Disable MySQL Query Auditing for One Hour?

Enable Query Auditing in MySQL

If you're looking to monitor and log all queries executed on your MySQL database for an hour, you can turn on audit logging.

Audit Logging Configuration

To enable audit logging and dump the log to a file, execute the following commands in your MySQL console:

SET global log_output = 'FILE';
SET global general_log_file='/Applications/MAMP/logs/mysql_general.log';
SET global general_log = 1;

This will configure the database to write all queries to the specified log file. After an hour, you can stop logging by executing:

SET global general_log = 0;
Latest tutorial More>

Disclaimer: All resources provided are partly from the Internet. If there is any infringement of your copyright or other rights and interests, please explain the detailed reasons and provide proof of copyright or rights and interests and then send it to the email: [email protected] We will handle it for you as soon as possible.

Copyright© 2022 湘ICP备2022001581号-3