ERROR 1146 (42S02): Table mysql.general_log does not exist

After updating mysql, I get this error in my Centos field when I tried to enable general_log. Any idea?

SET GLOBAL general_log = 'ON';

ERROR 1146 (42S02) : Table 'mysql.general_log' doesn't exist

+4
source share
3 answers

I created this missing table and worked for me.

Log in to mysql console

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
) ENGINE=CSV DEFAULT CHARSET=utf8 COMMENT='General log'
+3
source

When you find yourself in this situation, then there was a problem with updating MySQL and it was not correctly ported through datadir (for example, / usr / local / var / mysql) to a new installation.

So, the decision above will solve your immediate problem, but also indicates that you may have other problems installing MySQL.

+2

just adding Harikrishnan to the answer ! I had to change the type of fields to work from me, since MYSQL could not write to the table, therefore:

  • If shared_log is enabled, disable it SET GLOBAL general_log= 0;
  • Create table USE mysql; CREATE TABLE mysql.general_log( event_time TIMESTAMP(6) NOT NULL DEFAULTCURRENT_TIMESTAMP (6) ON UPDATECURRENT_TIMESTAMP(6), 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 MEDIUMBLOB NOT NULL ) ENGINE=CSV DEFAULT CHARSET=utf8 COMMENT='General log';

  • re-logging SET GLOBAL general_log= 1;

  • view magazine SELECT * FROM mysql.general_log;

0
source

Source: https://habr.com/ru/post/1534800/


All Articles