mysql_slow_query
Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| mysql_slow_query [2016/02/01 17:07] – luke7858 | mysql_slow_query [2024/05/23 07:26] (current) – external edit 127.0.0.1 | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| === Slow Query Logs === | === Slow Query Logs === | ||
| + | Checking the slow query logs via mysql prompt. | ||
| + | \\ | ||
| + | \\Note: You CAN enable the slow query logging on runtime. A mysql restart will flush the changes made via runtime. If you wish for persistence then add it to the /etc/my.cnf file: | ||
| + | <sxh bash> | ||
| + | mysql> SHOW GLOBAL VARIABLES LIKE ' | ||
| + | +---------------------+-------------------------------+ | ||
| + | | Variable_name | ||
| + | +---------------------+-------------------------------+ | ||
| + | | slow_query_log | ||
| + | | slow_query_log_file | / | ||
| + | +---------------------+-------------------------------+ | ||
| + | </ | ||
| + | Set the logs to another path: | ||
| + | <sxh bash> | ||
| + | mysql> SET GLOBAL slow_query_log_file = '/ | ||
| + | </ | ||
| + | <sxh bash> | ||
| + | mysql> SET GLOBAL slow_query_log = ' | ||
| + | </ | ||
| + | \\ | ||
| + | Via the command line: | ||
| + | \\ | ||
| + | \\ | ||
| You can check to see if slow query logging is currently enabled. The following command assumes you have configured .my.cnf file: | You can check to see if slow query logging is currently enabled. The following command assumes you have configured .my.cnf file: | ||
| <sxh bash> | <sxh bash> | ||
| - | show full variables like " | + | show variables like " |
| </ | </ | ||
| Or you can run the following from the command line: | Or you can run the following from the command line: | ||
| Line 43: | Line 66: | ||
| === Configuring Slow Query logs === | === Configuring Slow Query logs === | ||
| \\ | \\ | ||
| - | There are now 2 options for configuring slow query logging. You can add the settings | + | There are 2 options for configuring slow query logs: |
| + | \\ | ||
| + | \\ | ||
| + | -** Run time** - this will configure the slow query logs in the current runtime environment, | ||
| + | \\ | ||
| + | \\ | ||
| + | - **Permanent** - editing | ||
| \\ | \\ | ||
| + | \\ | ||
| + | **__NOTE__**: | ||
| + | \\ | ||
| \\ | \\ | ||
| === Run-time Configuration === | === Run-time Configuration === | ||
mysql_slow_query.1454346471.txt.gz · Last modified: 2024/05/23 07:26 (external edit)
