1583
MariaDBERRORNotableLoggingHIGH confidence

Cannot rename a log table when logging is active

Production Risk

Low — the RENAME fails; logging continues.

What this means

An attempt was made to rename a log table while the corresponding log is active.

Why it happens
  1. 1RENAME TABLE on mysql.general_log or mysql.slow_log while general_log or slow_query_log is ON.
How to reproduce
trigger — this will error
trigger — this will error
RENAME TABLE mysql.general_log TO mysql.general_log_backup;

expected output

ERROR 1583 (HY000): Cannot rename a log table if logging is active

Fix

Disable the log before renaming

Disable the log before renaming
SET GLOBAL general_log = 'OFF';
RENAME TABLE mysql.general_log TO mysql.general_log_backup;
RENAME TABLE mysql.general_log_new TO mysql.general_log;
SET GLOBAL general_log = 'ON';

Why this works

Disabling the log releases the table so it can be safely renamed.

Sources
Official documentation ↗

MySQL 8.0 — 1583 ER_CANT_RENAME_LOG_TABLE

Content generated with AI assistance and reviewed for accuracy. Found an error? hello@errcodes.dev

← All MariaDB errors