Search code examples
mysqldatabaseverificationdata-cleaningusage-statistics

How to check which MySQL-databases are still in use? #CleaningUp


I am having a cleaning situation over here, the old programmer didn't clean up his out-of-use databases & users. While some of the databases are still in use by external sites (on other ftp-servers), some are obsolete and just cluttering up the system.

My question is: How can I figure out which databases (& users) are still in use by other websites? (without checking every website that has ever been created where ever this might be located)

I need to be sure that a MySQL database (& user) are not actively being used by any site anymore, so I can safely delete it to clean up the system.

p.s.: It could also be that a database is still in use, but doesn't do any INSERTs or UPDATEs at all, but only SELECTs the data to load the website.

p.p.s.: I can't (temporary) deactivate/remove databases (& users), because this will cause clients to lose revenue, customers, search ranking etc. etc. and at the end will cost us/me.


Solution

  • Well, if you want even selects I think your options is general query log https://dev.mysql.com/doc/refman/5.7/en/query-log.html Enable it, parse it and get used dbs/tables