/etc/mysql/mysql.conf.d/mysqld.cnf and add a
max_execution_time line to the mysqld section
In general this file is loaded because
/etc/mysql/my.cnf includes it.
/etc/mysql/conf.d/ is client settings and
/etc/mysql/mysql.conf.d/ is server settings
I like this because occassionally some user will come up with an API request that triggers a query which takes hours and this will lookup the whole server until I fix it manually. Even a long timeout like 30s means these users don’t take down the service for very long.