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/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- MySQL查詢報錯:ERROR 1146 (42S02): Table 'craw.sitePageConfig' doesn't existMySqlError
- lower_case_table_names引數設定解決Error Code: 1146. Table doesn't exist?Error
- 'mysql.column_stats' doesn't exist and Table 'mysql.index_stats' doesn't existMySqlIndex
- MYSQL ERROR 1146 Table doesnt exist 解析MySqlError
- [BUG反饋]子查詢報錯,Base table or view not found: 1146 Table 'onethink.(' doesn't existView
- 易優CMS【錯誤程式碼】 SQLSTATE【42S02】:Base table or view not found:1146 Table‘111.ey_admin_theme‘doesn‘t exist-eyoucmsSQLView
- Fatal error: Can't open and lock privilege tables: Table 'mysql.user' doesn't exist解決辦法ErrorMySql
- MySQL 啟動報錯 Table 'mysql.plugin' doesn't existMySqlPlugin
- about Res folder doesn't exist in android projectAndroidProject
- SNMP TABLE ERROR : Requested table is empty or does not existError
- doesn't contain a valid partition tableAI
- Linux環境下MySQL報Table 'xxx' doesn't exist錯誤解決方法LinuxMySql
- MySQL 5.5原始碼安裝時啟動資料庫報錯"Table 'mysql.user' doesn't exist??"MySql原始碼資料庫
- MIRO Error:Table T169V: entry G180 does not existError
- 帝國CMS重新整理資料表article提示Table ‘empirecms.phome_ecms_’ doesn’t exist的解決
- MySQL DROP TABLE刪除表報錯'ERROR 1051 (42S02): Unknown table'MySqlError
- [ERROR] Can't open the mysql.plugin tableErrorMySqlPlugin
- Android Studio Git No tracked branch configured for branch branch_name or the branch doesn't existAndroidGit
- ERROR 1364 (HY000): Field 'ssl_cipher' doesn't have a default valueError
- scrollTop doesn't scroll on Chrome 61Chrome
- C++ doesn't name a typeC++
- from v * ERROR at line 1: ORA-00942: table or view does not existErrorView
- 安裝mysql遇到ERROR: 1136 Column count doesn't match value count at row 1MySqlError
- 解決安裝ubuntu系統時出現錯誤:(10, “debian-installer/locale doesn‘t exist“)Ubuntu
- Solaris 5.8 CRON doesn't work with regular user
- MySQL報錯Table 'plugin' is read only [ERROR] Can't open the mysql.plugin table.MySqlPluginError
- MIGO Error:Check table 169P: entry G180 does not existGoError
- Setup had an error Error: At least one of these paths should existErrorAST
- ORA-00942: table or view does not existView
- 解決Error (1133): Can’t find any matching row in the user tableError
- 【MySQL】ERROR 1005 (HY000): Can't create table' (errno: 150)MySqlError
- if doesn't support the "condition"attribute 問題解決
- PSQLexception: ERROR : type "signed" does not existSQLExceptionError
- PL/SQL: ORA-00942: table or view does not existSQLView
- ERROR 1005 (HY000): Can't create table 'starive.SC' (errno: 150)"Error
- user management table and t-code
- Field ‘spu_id‘ doesn‘t have a default valu 解決辦法
- ERROR 1005 (HY000): Can't create table'matrix.system_log' (errno: 150)Error