Monitor MySQL DB Activity

One way to monitor DB activity in MySQL is to enable logging and then tail the log file.

mysql -u root -p

You can check the status of logging and get the path of the log file with:

SHOW VARIABLES LIKE "general_log%";

And then enable logging with:

SET GLOBAL general_log = 'ON';

Finally, tail the log:

tail -f /usr/local/var/mysql/MUSPB250049-419.log

Monitoring MySQL logs
Monitoring MySQL logs

Tested on: MacOS Catalina, MySQL v8.019

Sharing is caring!

Leave a Comment

Your email address will not be published. Required fields are marked *

Notice: Undefined index: total_count_position in /var/www/wordpress/wp-content/plugins/social-pug/inc/functions-frontend.php on line 46