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.

configuration

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

[mysqld]
log-output=TABLE
general-log

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

[mysqld]
log-output=TABLE,FILE
general-log
general-log-file=/var/log/mysql_general.log

Step 5: Restart MySQL

service mysql restart

© 2019, Techrunnr. All rights reserved.

#1
#2
#3
Questions Answered
Articles Written
Overall Points
Categories: database

Prabhin Prabharkaran

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

Leave a Reply

Please wait...

Subscribe to our newsletter

Want to be notified when our article is published? Enter your email address and name below to be the first to know.