The InnoDB MySQL storage engine has row-level locks, while the MySQL MyISAM storage engine has table-level locks. MyISAM simply locks entire tables and does not support transactions, so it is not possible to have locks at the database level. Please note that an application can block another application while sitting on a table lock in a table that they are both trying to access, but this is a code error, not a db deadlock.
InnoDB supports transactions and has row-level locks, so db-level deadlocks are possible (and sometimes they can occur on a busy system, so you need to encode them). Many of what MySQL will call “deadlocks” are not “true deadlocks” because they are the result of slow UPDATEs, causing other timing queries to lock rows.
source share