mysql-slow-query-log

Why does `log_slow_queries` break `my.cnf`?

人走茶凉 提交于 2020-01-12 03:09:12
问题 Why can't I use slow_query_log on MySQL 5.6 on CentOS 6.4? [mysqld] datadir=/var/lib/mysql socket=/var/lib/mysql/mysql.sock ... ## Logging ## *** THESE LOGS WORK JUST FINE *** log_error = /var/log/mysql/error.log general_log_file = /var/log/mysql/mysql.log general_log = 1 ## *** THESE LOGS BREAK MYSQL *** #log_slow_queries = /var/log/mysql/slow.log #long_query_time = 5 #log-queries-not-using-indexes Here's the /var/log/mysql directory: $ ls -lh total 100K -rw-r----- 1 mysql root 47K Nov 22 06

How to flush data from mysql.slow_log table in mysql?

自闭症网瘾萝莉.ら 提交于 2019-12-22 06:56:55
问题 Hi i am working on MySQL version 5.5, can somebody please help me to clear/flush data from mysql.slow_log tables in mysql ? 回答1: If you are on linux > mysql -uroot -p > enter your password > use mysql; > delete from slow_log; It will give you an error that you can't lock log tables. Work around is, run the following queries: SET GLOBAL slow_log= 'OFF'; RENAME TABLE slow_log TO general_log_temp; DELETE FROM `general_log_temp`; RENAME TABLE general_log_temp TO slow_log ; SET GLOBAL slow_log =

mysql 5.7 log-slow-queries error

僤鯓⒐⒋嵵緔 提交于 2019-12-20 13:32:17
问题 I'm trying to enable Slow Query Logging on mysql 5.7 and getting this error: 2016-04-27T14:55:51.934612Z 0 [ERROR] unknown variable 'log-slow-queries=/var/log/mysql-query.log' 2016-04-27T14:55:51.934639Z 0 [ERROR] Aborting In my /etc/my.cnf file I have "log-slow-queries=/var/log/mysql-query.log" defined, but I'm going to assume that in 5.7 that is invalid. What is the correct my.cnf settings to enable query logging? Thanks, 回答1: Name of the MySQL system variable is slow_query_log_file And to

How to Trace Mysql Slow-query-log-file Entries Using PHP Profiler

喜夏-厌秋 提交于 2019-12-13 03:58:31
问题 I just started using PHP profiler to find files in php script which caused slow mysql queries. Some suggested that I use xdebug to track it with the timestamp from the slow log-file entry compared to the files in php profiler that was executed at the same timestamp. I have read the xdebug documentation but can't find an explanation of this problem. Can anyone give me enlightenment? I'm using php 7.0, Debian 9. My slow-query-log-file entries: # Thread_id: 222244 Schema: user QC_hit: No # Query

MySQL SUM Query is extremely slow

好久不见. 提交于 2019-12-11 07:19:02
问题 There is a table called transactions with ~6 million rows. Below query counts the current user balance. Here is the log after I enabled slow_query_log = 'ON' : # Time: 170406 9:51:48 # User@Host: root[root] @ [xx.xx.xx.xx] # Thread_id: 13 Schema: main_db QC_hit: No # Query_time: 38.924823 Lock_time: 0.000034 Rows_sent: 1 Rows_examined: 773550 # Rows_affected: 0 SET timestamp=1491456108; SELECT SUM(`Transaction`.`amount`) as total FROM `main_db`.`transactions` AS `Transaction` WHERE

Mysql slow query log is logging faster queries

我的梦境 提交于 2019-12-10 19:49:21
问题 I've setup mysql slow query log on my database server and set the long query time to 5. Just checked the log and its logging queries that take only milliseconds. Anyone know why that would be?, here's some of the log. The last query isn't exactly the most optimised. It says it examined 450000 rows so I wouldn't be surprised seeing it in the log. However the query time said it only took 0.2secs. Is there more to the slow query log then just query execution time? # Query_time: 0.000525 Lock

MySQL slow query log logging fast queries [closed]

房东的猫 提交于 2019-12-05 16:38:21
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 7 years ago . I'm having an issue where MySQL seems to be logging queries in the slow query log that are faster than the time specified. I've configured MySQL to log the following: Server version: 5.1.54-1ubuntu4-log +---------------------+-------------------------------+ | Variable_name | Value | +---------------------+-----