Mysql – Identify thesqldump activity in MySQL log file

backupdebuggingMySQLmysqldump

I have a database that is being regularly backed up by mysqldump by… something. It's not a script that I wrote, not sure whose it is. I'm trying to find out more about these dumps, such as what database user they are being executed as. Is there a way to identify an execution of mysqldump in the regular mysql logs?

The database being backed up is hosted on a mysql server, version 5.5.49.

I can't provide the options used to call mysqldump because mysqldump is not called from any script of mine. I am trying to find the script (it does not appear to be in any normal cron job – I think it is someone's custom script), and I think that if I can determine what user it runs as, I can probably find the person who wrote it.

Best Answer

SUGGESTION #1

The quickest way to locate any dump activity is the enable the slow query log

You should find queries that resemble something like the following

SELECT /* SQL_NO_CACHE */ from ...

Any large table running a long dump has to show up in the slow log.

If all the tables are small, then lower long_query_time with

SET GLOBAL long_query_time = 0.2;

Let it run for a few hours. Then change it back to 10.

SET GLOBAL long_query_time = 10;

If you don't change it back, the slow log will grow big very quickly.

SUGGESTION #2

Another way would be to check the process list. Please see my 5-year-old post (How to detect a running mysqldump?)

In your case, just run the following query

SELECT * FROM information_schema.processlist
WHERE info like 'SELECT%'
AND   info like '%SQL_NO_CACHE%';

This query will tell you the Process ID, MySQL username, and host doing the mysqldump.

GIVE IT A TRY !!!