I dropped general_log table, how do I create it again?
Recreate:
USE mysql;
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` int(11) 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';
Clear table:
TRUNCATE table mysql.general_log;
This is the updated version, the 2012 answers do not work anymore:
CREATE TABLE mysql.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'
For 1.:
USE mysql;
CREATE TABLE `general_log` (
`event_time` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
`user_host` MEDIUMTEXT NOT NULL,
`thread_id` INT(11) NOT NULL,
`server_id` INT(10) UNSIGNED NOT NULL,
`command_type` VARCHAR(64) NOT NULL,
`argument` MEDIUMTEXT NOT NULL
)
COMMENT='General log'
COLLATE='utf8_general_ci'
ENGINE=CSV;
For 2.:
TRUNCATE mysql.general_log;