ERROR 1146 (42S02): Table 'mysql.slow_log' doesn't exist
去檢視最新的slow log,發現沒有最新的記錄,上去檢查slow log是否開啟了。
mysql> show variables like '%slow%';
+---------------------+------------------------------------------+| Variable_name | Value |
+---------------------+------------------------------------------+
| log_slow_queries | OFF |
| slow_launch_time | 2 |
| slow_query_log | OFF |
| slow_query_log_file | /mysqllog/slow_log/slow_queries_3306.log |
+---------------------+------------------------------------------+
4 rows in set (0.00 sec)
看到OFF,果然關閉了,立即開啟。
ERROR 1146 (42S02): Table 'mysql.slow_log' doesn't exist
mysql> mysql>
mysql> set global slow_query_log=1;
ERROR 1146 (42S02): Table 'mysql.slow_log' doesn't exist
mysql>
mysql> exit
Bye
報錯了,去mysql庫check下,有無這個表:
mysql> use mysql
Database changed
mysql> desc slow_log;
ERROR 1146 (42S02): Table 'mysql.slow_log' doesn't exist
mysql.slow_log表還是必須的,沒有這個表slow log 也不能輸出到FILE。該表,是當開啟引數log_output設定為table的時候,slow.log會記錄到這個表裡面,但是由於記錄該表會對效能有影響,所以一般都是記錄到FILE裡面,然後再用指令碼來處理。現在報錯那就臨時建立下這個表試試看,不過記得關閉寫入二進位制,因為是雙主嘛:
mysql> set session sql_log_bin=0;
Query OK, 0 rows affected (0.00 sec)
mysql> use mysql
Database changed
mysql> CREATE TABLE `slow_log` (
-> `start_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
-> `user_host` mediumtext NOT NULL,
-> `query_time` time NOT NULL,
-> `lock_time` time NOT NULL,
-> `rows_sent` int(11) NOT NULL,
-> `rows_examined` int(11) NOT NULL,
-> `db` varchar(512) NOT NULL,
-> `last_insert_id` int(11) NOT NULL,
-> `insert_id` int(11) NOT NULL,
-> `server_id` int(10) unsigned NOT NULL,
-> `sql_text` mediumtext NOT NULL
-> ) ENGINE=CSV DEFAULT CHARSET=utf8 COMMENT='just only a slow log';
Query OK, 0 rows affected (0.02 sec)
mysql>
mysql>
然後再去開啟slow log 日誌
mysql> set global slow_query_log=1;
Query OK, 0 rows affected (0.00 sec)
mysql>
mysql>
mysql>
mysql> select sleep(10),1 as a;
+-----------+---+
| sleep(10) | a |
+-----------+---+
| 0 | 1 |
+-----------+---+
1 row in set (10.00 sec)
mysql>
然後去check下這個慢查詢sql是否寫入slow log了
ll slow_queries_3306.log
-rw-rw---- 1 mysql mysql 0 Feb 10 04:10 slow_queries_3306.log
竟然是空的,為什麼?
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/26230597/viewspace-1123960/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- 易優CMS【錯誤程式碼】 SQLSTATE【42S02】:Base table or view not found:1146 Table‘111.ey_admin_theme‘doesn‘t exist-eyoucmsSQLView
- [BUG反饋]子查詢報錯,Base table or view not found: 1146 Table 'onethink.(' doesn't existView
- 115 svn: URL 'svn://132.232.108.38/think' doesn't exist
- 帝國CMS重新整理資料表article提示Table ‘empirecms.phome_ecms_’ doesn’t exist的解決
- Android Studio Git No tracked branch configured for branch branch_name or the branch doesn't existAndroidGit
- 解決安裝ubuntu系統時出現錯誤:(10, “debian-installer/locale doesn‘t exist“)Ubuntu
- MySQL報錯Table 'plugin' is read only [ERROR] Can't open the mysql.plugin table.MySqlPluginError
- Setup had an error Error: At least one of these paths should existErrorAST
- PSQLexception: ERROR : type "signed" does not existSQLExceptionError
- MySQL 5.6執行DDL報錯ERROR 1050 (42S01): Table 'sms/#sql-ib752' already existMySqlError
- 1146
- SAP MM 對採購訂單執行收貨,報錯 - Table T169P entry ZNMI does not exist -
- adb連線失敗報錯“AdbProcess::error:adb server version (32) doesn‘t match this client (41); killing...”的修復ErrorServerclient
- 2018 icpc徐州站網路賽 H Ryuji doesn't want to study
- Field ‘spu_id‘ doesn‘t have a default valu 解決辦法
- ERROR 1114 (HY000) The table '' is fullError
- [20221227]a mutating table error without a trigger!.txtError
- yii2接入pgSQL(查詢不到表The table does not exist: {{%user}})SQL
- GTID環境中手動修復主從故障一例(Error 1146)Error
- adb server version (31) doesn’t match this client (36); killing… 的解決方法Serverclient
- OSError: [E050] Can‘t find model ‘en_core_web_sm‘. It doesn‘t seem to be a shortcut link, a Python pErrorWebPython
- 解決pgpool啟動報錯 ifup[/sbin/ip] doesn't have setuid bitUI
- 錯誤訊息 This computer doesn't have VT-X/AMD-v enabled
- Error: The directory named as part of the path ./log/supervisord.log does not exist解決方案Error
- SpringBoot+ajax踩的坑Error resolving template, template might not exist or might not be accessibleSpring BootError
- 資料庫報錯java.sql.SQLException: Field ‘id‘ doesn‘t have a default value資料庫JavaSQLException
- pymysql.err.OperationalError: (1136, “Column count doesn‘t match value count at row 1“)報錯反省。MySqlError
- MyIsam 表 “ Incorrect key file for table 't_ '; try to repair it”AI
- You can‘t specify target table ‘Person‘ for update in FROM clause
- ICPC2018徐州網路賽 H.Ryuji doesn't want to study ( 樹狀陣列陣列
- wget下載安裝時出現錯誤doesn‘t match requested host name錯誤wget
- MYSQL報1022錯誤:Can't write;duplicate key in table '.....'MySql
- mysql中You can’t specify target table for update in FROM clMySql
- Error:Can't connect to SOCKS proxy:Connection refused (Connection refused)Error
- GTID複製報錯處理:Last_Error: Error 'Can't drop database 'test';ASTErrorDatabase
- ABAP 資料結構啟用時的錯誤訊息 - combination reference table field does not exist資料結構
- ERROR 1786 (HY000): Statement violates GTID consistency: CREATE TABLE ... SELECTError
- Fatal error: can't check configuration file '/home/watt/proxy/dError
- 解決ERROR 1231 (42000): Variable 'time_zone' can'tError