filmov
tv
MySQL :How to enable slow query logging in mysql server on Linux
![preview_player](https://i.ytimg.com/vi/sGDg2oWd-GQ/maxresdefault.jpg)
Показать описание
How to Enable Slow Query Logging for MySQL Server on linux
**********************************************************
The Slow Query Logging is used to capture the queries which do not use indexes .
execute for long time which is defined by long_query_time.
By default the value for long_query_time is 10 seconds.
mysql -u root -p
show variables like '%slow_query_log%';
show variables like '%long_query_time%';
Output
******
mysql show variables like '%slow_query_log%';
+---------------------+-----------------------------+
| Variable_name | Value |
+---------------------+-----------------------------+
| slow_query_log | OFF |
+---------------------+-----------------------------+
mysql show variables like '%long_query_time%';
+-----------------+-----------+
| Variable_name | Value |
+-----------------+-----------+
| long_query_time | 10.000000 |
+-----------------+-----------+
Slow Query Log File in Linux system
***********************************
Defaul Location of Slow Query log file on Linux is /var/lib/MySQL.
slow-query-log=1
long_query_time=10
1. service mysqld stop
slow-query-log=1
**********************************************************
The Slow Query Logging is used to capture the queries which do not use indexes .
execute for long time which is defined by long_query_time.
By default the value for long_query_time is 10 seconds.
mysql -u root -p
show variables like '%slow_query_log%';
show variables like '%long_query_time%';
Output
******
mysql show variables like '%slow_query_log%';
+---------------------+-----------------------------+
| Variable_name | Value |
+---------------------+-----------------------------+
| slow_query_log | OFF |
+---------------------+-----------------------------+
mysql show variables like '%long_query_time%';
+-----------------+-----------+
| Variable_name | Value |
+-----------------+-----------+
| long_query_time | 10.000000 |
+-----------------+-----------+
Slow Query Log File in Linux system
***********************************
Defaul Location of Slow Query log file on Linux is /var/lib/MySQL.
slow-query-log=1
long_query_time=10
1. service mysqld stop
slow-query-log=1