docker run --name mysql -v ~/docker/mysql:/var/lib/mysql -e MYSQL_ROOT_PASSWORD=mysqlqweasd -d mysql

Next Key Locks

a combination of a record lock on the index record (index in the gap), and a gap lock on the gap before the index record

UPDATE mytable WHERE id > 18;

you can’t get the lock on 19, because some other session already has locked the gap that includes the value 19 you want to insert, as well as 20, which is the next key after 19 that really exists in the index.