MySQL Error: Timeout exceeded in regular expression match Sep 16th 2021 Words: 74

Problem

When executing SQL query involving regular expression, a timeout error is sometimes emitted. For example, running SELECT * FROM product WHERE discription RLIKE '^pickel .*' produces ERROR 3700 (HY000): Timeout exceeded in regular expression match.

Solution

Temporarily

Run the following query with MySQL root:

1
SET GLOBAL regexp_time_limit= 0;

Permanently

Add the following content in the /etc/mysql/conf.d/regex_limit.cnf:

1
2
[mysqld]
regexp_time_limit=0

References