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;
The above is the detailed content of How Can I Enable and Disable MySQL Query Auditing for One Hour?. For more information, please follow other related articles on the PHP Chinese website!