log user activities in MYSQL1 min read

We need your support!!
Other Amount:
techrunnr.com:
24-Hour Flash Sale. Courses from just ₹ 490.
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.

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

We need your support!!
Other Amount:
techrunnr.com:
#1
#2
#3
Questions Answered
Articles Written
Overall Points

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!!

You may also like...

Leave a Reply