log user activities in MYSQL1 min read

Prabhin Prabharkaran Administrator
DevOps Engineer

He is a Technical professional. He is a person who loves to share tricks and tips on the Internet. He Posts what he does!

follow me

Hi All, this document deals with how to log user activities in MYSQL.
It is always required to log all the user activities happening in MySQL when a server is used by multiple persons or application.

So here are the steps to achieve it.


Step 1: Login to the Mysql server.
Step 2: Create a General log file.

CREATE TABLE mysql.general_log_original LIKE mysql.general_log;
ALTER TABLE mysql.general_log ENGINE=MyISAM;
ALTER TABLE mysql.general_log ADD INDEX (event_time);

Step 3: Enable the general log

Add the following to /etc/my.cnf


Step 4: If you also want the text version of the general log, add this:


Step 5: Restart MySQL

service mysql restart

© 2019, Techrunnr. All rights reserved.

Questions Answered
Articles Written
Overall Points

Related posts

Leave a Reply