I dropped general_log table, how do I create it again?

前端 未结 6 1754
渐次进展
渐次进展 2021-01-31 06:16

Logging enabled

I enabled logging using:

SET GLOBAL log_output = \'TABLE\';
SET GLOBAL general_log = \'ON\';

All executed queries was lo

6条回答
  •  眼角桃花
    2021-01-31 06:31

    Ok, having first hand experience, this is what worked for me, if your table gets corrupted by any reason whatsoever, works with MySQL 5.6.11

    use mysql;
    SET GLOBAL general_log = 'OFF';
    
    DROP TABLE general_log;
    
    CREATE TABLE IF NOT EXISTS `general_log` (
      `event_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
      `user_host` mediumtext NOT NULL,
      `thread_id` bigint(21) unsigned NOT NULL,  -- Be careful with this one.
      `server_id` int(10) unsigned NOT NULL,
      `command_type` varchar(64) NOT NULL,
      `argument` mediumtext NOT NULL
    );
    
    SET GLOBAL general_log = 'ON';
    
    SET GLOBAL log_output = 'TABLE';
    
    select * from mysql.general_log
    order by event_time desc;
    

提交回复
热议问题