Answers for "query log"

SQL
0

global sql log

# Create a table for it
CREATE TABLE `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,
   `server_id` int(10) unsigned NOT NULL,
   `command_type` varchar(64) NOT NULL,
   `argument` mediumtext NOT NULL
  ) ENGINE=CSV DEFAULT CHARSET=utf8 COMMENT='General log';

# Enable Query logging on the database
SET global general_log = 1;
SET global log_output = 'table';

# View the log by running this query:
SELECT
    *
FROM
    mysql.general_log;
    
# Disable when done
SET global general_log = 0;
Posted by: Guest on January-06-2021

Code answers related to "SQL"

Browse Popular Code Answers by Language