MariaDB - ERROR 1556 (HY000): You can't use locks with log tables.

  • Last update: Apr 3, 2024
  • Views: 36
  • Author: Admin
MariaDB - ERROR 1556 (HY000): You can't use locks with log tables.

Hello colleagues.

Every DBA or developer when working with a MariaDB database may encounter an error such as -  ERROR 1556 (HY000): You cannot 'DROP' a log table if logging is enabled on query. Default database: 'mysql'. This error can occur when you set up replication between databases or when you perform a full restore of a database from a backup.

The reason for this error is that you may have the general query recording mode enabled or the slow query recording mode enabled.

 

The logging mode for general queries is set to  general_log and defaults to OFF. To view the value of a parameter, you need to use the sql command:

sql> SHOW VARIABLES LIKE 'general_log';

 

The slow_query_log parameter is responsible for the mode of logging slow queries,  and it is also set to OFF by default. To view the value of a parameter, you need to use the sql command:

sql> SHOW VARIABLES LIKE 'slow_query_log';

 

If you have at least one of these features enabled, then you need to disable it, and after you have completed your robots with the database, you can enable them again if you need them.


 

To disable these features, you need to run simple sql commands in the mariadb console:

sql> SET general_log = 'OFF';
sql> SET slow_query_log = 'OFF';


 

Once you've finished your database robots, these features can be re-enabled. To enable these functions, you need to execute sql commands:

sql> SET general_log = 'ON';
sql> SET slow_query_log = 'ON';

 

Thank you all, I hope my article was of some help to you.

SIMILAR ARTICLES