[Solved] mysqldump: Got error: 1556: “You can‘t use locks with log tables.“ when using LOCK TABLES

Problem description

Recently, when backing up MySQL data, an error was found in dump database:

mysqldump: Got error: 1556: "You can't use locks with log tables." when using LOCK TABLES

Solution steps:

Checked because there are two table locks in the dump MySQL library.

Add --lock-tables =0 after mysqldump instruction.

Summary

Mysqldump backup will turn on the lock table by default – opt is turned on by default, which will affect the online business when backing up big data

To prevent this, we can use --skip-opt to cancel this default option in backup After adding this parameter, the above error report will not appear.

mysqldump  --skip-opt -h<host> -u<user> -p<password> -A  >> backup.sql    --Perform full backups

Read More: