The total number of lock exceeds the lock table size in MySQL

Below error when using python with sqlalchemy module and MySQL MariaDB.

Error:

OperationalError: (MySQLdb.OperationalError) (1206, 'The total number of locks exceeds the lock table size')
[SQL: DELETE FROM `4g_day_eid` WHERE `Date` = '0000-00-00']
(Background on this error at: [https://sqlalche.me/e/14/e3q8)](https://sqlalche.me/e/14/e3q8))

MySQL is trying to tell you that it doesn’t have enough room to store all of the row locks that it would need to execute your query. The only way to fix it for sure is to adjust innodb_buffer_pool_size and restart MySQL. By default, this is set to only 8MB, which is too small for anyone who is using InnoDB to do anything.

Steps:

    1. Shutdown MySQL Server

    2. Edit my.ini file in “..\mysql\bin\my.ini”

    mysql_my_dot_ini_file

    3. Change innodb_buffer_pool_size (from 16M to 64M) and innodb_log_file_size (from 5M to 16M):

    ## You can set .._buffer_pool_size up to 50 - 80 %
    ## of RAM but beware of setting memory usage too high
    innodb_buffer_pool_size=64M
    	
    ## Set .._log_file_size to 25 % of buffer pool size
    innodb_log_file_size=16M

    4. Start MySQL Server

    Leave a comment