Is it possible to create a custom log table. For example I have 10 schema and I would like to log if somebody is using the "areva" schema. I want to know the last executed command time and the user. Is this possible in MySQL?
- Anybody can ask a question
- Anybody can answer
- The best answers are voted up and rise to the top
I experimented with trying to create a trigger for a system table (mysql.slow_log). It simply cannot be done. However, there is a rather unconventional method you may want to try:
Step 01) Activate the slow_log with the output as a table and restart mysql
Step 02) Convert slow_log to MyISAM, copy it to areva_log, and index slow_log on db
Step 03) Create a Stored Procedure to Copy all Slow Log entries whose db is areva into mysql.areva_log
Step 04) Call the stored procedure every 15 minutes using a crontab or using a mysql event
Step 05) Zap the slow log every week, month, or year:
Give it a Try !!!