How to set max_execution_time during mysqldump
04:32 27 Jun 2022

I am trying to take a backup of my database in a CI before database schema change are made and for local development. However recently we ran into an issue where some tables are to large to dump, we get the following error:

mysqldump: Error 3024: Query execution was interrupted, maximum statement execution time exceeded when dumping table social_post at row: 24988140

After investigating i found that if i modify the max_execution_time from 600000 (10 mins) to 0 (unlimited). The backup works, it takes approx 1 hour and 10 mins to get make a full backup. (we tried 15 minutes and even 20 minutes and it was not enough)

We don't want to permanently set this value to unlimited because of possible consequences, we'd like to just change it for the duration of the mysqldump.

Is there some way to set max_execution_time for mysqldump.

mysqldump --defaults-extra-file=login.cnf --set-gtid-purged=OFF --single-transaction --events --routines --no-create-info --no-create-db --skip-triggers --complete-insert --verbose --quick database_name > data.sql
mysql amazon-rds