{"id":2057,"date":"2010-06-07T20:17:49","date_gmt":"2010-06-07T16:47:49","guid":{"rendered":"https:\/\/parspack.com\/kill-mysql-slow-queries\/"},"modified":"2024-09-09T14:53:32","modified_gmt":"2024-09-09T10:23:32","slug":"kill-mysql-slow-queries","status":"publish","type":"post","link":"https:\/\/parspack.com\/blog\/hosting\/learn-server\/kill-mysql-slow-queries","title":{"rendered":"\u067e\u06cc\u062f\u0627 \u06a9\u0631\u062f\u0646 \u06a9\u0648\u0626\u0631\u06cc \u0647\u0627\u06cc \u06a9\u0646\u062f \u06a9\u0646\u0646\u062f\u0647 \u062f\u0631 mysql"},"content":{"rendered":"<div class=\"global-rtl\" dir=\"rtl\" style=\"text-align: right;\">\n<div class=\"global-rtl\" style=\"text-align: justify;\">MySQL \u0645\u06cc \u062a\u0648\u0627\u0646\u062f \u06a9\u0648\u0626\u0631\u06cc \u0647\u0627\u06cc\u06cc ( queries ) \u00a0\u06a9\u0647 \u0627\u0632 \u06cc\u06a9 \u0645\u062f\u062a \u0632\u0645\u0627\u0646 \u0645\u0634\u062e\u0635 \u0645\u0627\u0646\u0646\u062f X \u0637\u0648\u0644\u0627\u0646\u06cc \u062a\u0631 \u0645\u06cc \u0634\u0648\u062f\u060c \u0631\u0627 \u062b\u0628\u062a \u0646\u0645\u0627\u06cc\u062f \u0648 \u06cc\u0627 \u0627\u0635\u0637\u0644\u0627\u062d\u0627 Log \u06a9\u0646\u062f. \u0627\u06cc\u0646 \u0627\u0645\u06a9\u0627\u0646 \u062f\u0631 \u062d\u0627\u0644\u062a \u0627\u0648\u0644\u06cc\u0647 ( default ) \u00a0\u063a\u06cc\u0631 \u0641\u0639\u0627\u0644 \u0645\u06cc \u0628\u0627\u0634\u062f. \u0647\u0645\u0627\u0646\u0637\u0648\u0631 \u06a9\u0647 \u0645\u06cc \u062f\u0627\u0646\u06cc\u062f \u06a9\u0648\u0626\u0631\u06cc \u0647\u0627\u06cc \u06a9\u0646\u062f mysql \u0645\u0646\u062c\u0631 \u0628\u0647 \u06a9\u0646\u062f \u0634\u062f\u0646 \u0633\u0631\u0648\u0631 \u0634\u0645\u0627 \u0645\u06cc \u06af\u0631\u062f\u0646\u062f.<\/div>\n<\/div>\n<div class=\"global-rtl\" dir=\"rtl\" style=\"text-align: right;\">* \u062a\u0630\u06a9\u0631 \u0645\u0647\u0645: \u0627\u06af\u0631 \u0634\u0645\u0627 \u0627\u0632 \u0633\u0631\u0648\u0631 \u0645\u062c\u0627\u0632\u06cc \u0627\u0633\u062a\u0641\u0627\u062f\u0647 \u0645\u06cc \u06a9\u0646\u06cc\u062f\u060c \u0647\u0645\u06cc\u0646 \u0644\u0627\u06af \u06a9\u0631\u062f\u0646 \u0645\u06cc \u062a\u0648\u0627\u0646\u062f \u0645\u0646\u062c\u0631 \u0628\u0647 \u0627\u0641\u0632\u0627\u06cc\u0634 \u0645\u0635\u0631\u0641 \u0634\u0645\u0627 \u0627\u0632 \u0645\u0646\u0627\u0628\u0639 \u0633\u0631\u0648\u0631 \u06af\u0631\u062f\u062f \u0648 \u062c\u062f\u0627\u06cc \u0627\u0632 \u0622\u0646 \u062d\u062c\u0645 \u0628\u0627\u0644\u0627\u06cc\u06cc \u0631\u0627 \u0628\u0627 \u0630\u062e\u06cc\u0631\u0647 \u0644\u0627\u06af \u0641\u0627\u06cc\u0644 \u0647\u0627 \u062f\u0631 <a title=\"\u062e\u0631\u06cc\u062f \u0633\u0631\u0648\u0631\" href=\"\/servers\" target=\"_blank\" rel=\"noopener\"> \u0633\u0631\u0648\u0631 <\/a> \u0634\u0645\u0627 \u0627\u0634\u063a\u0627\u0644 \u0645\u06cc \u0646\u0645\u0627\u06cc\u062f\u060c \u067e\u0633 \u0627\u06af\u0631 \u0628\u0647 \u0641\u0639\u0627\u0644 \u0633\u0627\u0632\u06cc \u0622\u0646 \u0627\u0642\u062f\u0627\u0645 \u0646\u0645\u0648\u062f\u06cc\u062f\u060c \u0645\u06cc \u0628\u0627\u06cc\u0633\u062a \u062a\u0648\u062c\u0647 \u062e\u0648\u062f \u0631\u0627 \u062f\u0648 \u0686\u0646\u062f\u0627\u0646 \u06a9\u0646\u06cc\u062f \u0648 \u06a9\u0627\u0631 \u0628\u0647\u062a\u0631 \u0622\u0646\u0633\u062a \u06a9\u0647 \u062a\u0646\u0647\u0627 \u0628\u0647 \u0647\u0646\u06af\u0627\u0645 \u0646\u06cc\u0627\u0632 \u0627\u0632 \u0622\u0646 \u0627\u0633\u062a\u0641\u0627\u062f\u0647 \u06a9\u0646\u06cc\u062f.<\/div>\n<h3 class=\"global-rtl\" dir=\"rtl\" style=\"text-align: right;\"><span style=\"color: #0000ff;\">\u0686\u0646\u0627\u0646\u0686\u0647 \u062a\u0645\u0627\u06cc\u0644 \u0628\u0647 \u0641\u0639\u0627\u0644 \u0633\u0627\u0632\u06cc \u0622\u0646 \u062f\u0627\u0631\u06cc\u062f \u06a9\u0627\u0641\u06cc \u0627\u0633\u062a \u0645\u0631\u0627\u062d\u0644 \u0632\u06cc\u0631 \u0631\u0627 \u062f\u0646\u0628\u0627\u0644 \u0646\u0645\u0627\u0626\u06cc\u062f:<\/span><\/h3>\n<div class=\"global-rtl\" dir=\"rtl\" style=\"text-align: right;\">1. \u0627\u0632 \u0637\u0631\u06cc\u0642 \u0646\u0631\u0645 \u0627\u0641\u0632\u0627\u0631 \u067e\u06cc\u0648\u062a\u06cc \u0628\u0647 \u0633\u0631\u0648\u0631 \u062e\u0648\u062f \u0648\u0635\u0644 \u0634\u0648\u06cc\u062f.<\/div>\n<div class=\"global-rtl\" dir=\"rtl\" style=\"text-align: right;\">( \u0645\u06cc \u062a\u0648\u0627\u0646\u06cc\u062f \u0627\u0632 \u0627\u06cc\u0646 \u0644\u06cc\u0646\u06a9 \u0627\u0633\u062a\u0641\u0627\u062f\u0647 \u06a9\u0646\u06cc\u062f: \u00a0<a class=\"global-rtl\" href=\"https:\/\/parspack.com\/blog\/hosting\/learn-server\/putty-ssh\">\u0627\u062a\u0635\u0627\u0644 \u0628\u0647 ssh \u0627\u0632 \u0637\u0631\u06cc\u0642 \u0646\u0631\u0645 \u0627\u0641\u0632\u0627\u0631 putty<\/a> )<\/div>\n<div class=\"global-rtl\" dir=\"rtl\" style=\"text-align: right;\">2. \u0641\u0627\u06cc\u0644 \u0632\u06cc\u0631 \u0631\u0627 \u0628\u0627 \u06cc\u06a9\u06cc \u0627\u0632 \u0646\u0631\u0645 \u0627\u0641\u0632\u0627\u0631\u0647\u0627\u06cc \u0648\u06cc\u0631\u0627\u06cc\u0634 \u06af\u0631 \u0631\u0648\u06cc \u0633\u0631\u0648\u0631 \u062e\u0648\u062f \u0645\u0627\u0646\u0646\u062f vi \u06cc\u0627 vim \u06cc\u0627 nano \u0628\u0627\u0632 \u0646\u0645\u0627\u0626\u06cc\u062f:<\/div>\n<div dir=\"ltr\" style=\"text-align: right;\">\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">\/etc\/my.cnf<\/pre>\n<p>&nbsp;<\/p>\n<\/div>\n<div class=\"global-rtl\" dir=\"rtl\" style=\"text-align: right;\">\u0645\u0627\u0646\u0646\u062f \u062f\u0633\u062a\u0648\u0631 \u0632\u06cc\u0631:<\/div>\n<div dir=\"ltr\" style=\"text-align: right;\">\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">[root@localhost ~]#vi \/etc\/my.cnf\r\n<\/pre>\n<p>&nbsp;<\/p>\n<\/div>\n<h4 class=\"global-rtl\" dir=\"rtl\" style=\"text-align: right;\"><span style=\"color: #000080;\">\u062f\u0631 \u0628\u062e\u0634\u06cc \u06a9\u0647 \u062f\u0631 \u0628\u0627\u0644\u0627\u06cc \u0622\u0646 \u0639\u0628\u0627\u0631\u062a [mysqld] \u0646\u0648\u0634\u062a\u0647 \u0634\u062f\u0647 \u0627\u0633\u062a\u060c \u0645\u0648\u0627\u0631\u062f \u0632\u06cc\u0631 \u0631\u0627 \u0648\u0627\u0631\u062f \u0646\u0645\u0627\u0626\u06cc\u062f:<\/span><\/h4>\n<div dir=\"ltr\" style=\"text-align: right;\">\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">log_slow_queries=\/var\/log\/mysql_slow_queries.log\r\n<\/pre>\n<p>&nbsp;<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">long_query_time = 2<\/pre>\n<p>&nbsp;<\/p>\n<\/div>\n<div class=\"global-rtl\" dir=\"rtl\" style=\"text-align: right;\">\u0641\u0627\u06cc\u0644 \u0645\u0631\u0628\u0648\u0637\u0647 \u0631\u0627 save \u0646\u0645\u0627\u0626\u06cc\u062f \u0648 \u062e\u0627\u0631\u062c \u0634\u0648\u06cc\u062f.<\/div>\n<div class=\"global-rtl\" dir=\"rtl\" style=\"text-align: right;\">\u0628\u0646\u0627\u0628\u0631\u0627\u06cc\u0646 \u0644\u0627\u06af \u0641\u0627\u06cc\u0644 \u060c \u06a9\u0648\u0626\u0631\u06cc \u0647\u0627\u06cc\u06cc \u06a9\u0647 \u0628\u06cc\u0634 \u0627\u0632 2 \u062b\u0627\u0646\u06cc\u0647 \u0632\u0645\u0627\u0646 \u0645\u06cc \u06af\u06cc\u0631\u0646\u062f \u062f\u0631 \u0641\u0627\u06cc\u0644 var\/log\/mysql-slow.log \u0630\u062e\u06cc\u0631\u0647 \u0645\u06cc \u0634\u0648\u062f.<\/div>\n<h4 class=\"global-rtl\" dir=\"rtl\" style=\"text-align: right;\"><span style=\"color: #000080;\">3. \u0644\u0627\u06af \u0641\u0627\u06cc\u0644 \u0631\u0627 \u0628\u0627 \u062f\u0633\u062a\u0648\u0631 \u0632\u06cc\u0631 \u0628\u0633\u0627\u0632\u06cc\u062f:<\/span><\/h4>\n<div dir=\"ltr\" style=\"text-align: right;\">\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">[root@localhost ~]# touch \/var\/log\/mysql_slow_queries.log<\/pre>\n<p>&nbsp;<\/p>\n<\/div>\n<h4 class=\"global-rtl\" dir=\"rtl\" style=\"text-align: right;\"><span style=\"color: #000080;\">4. \u0645\u0627\u0644\u06a9\u06cc\u062a \u0622\u0646 \u0631\u0627 \u062a\u063a\u06cc\u06cc\u0631 \u062f\u0647\u06cc\u062f:<\/span><\/h4>\n<div dir=\"ltr\" style=\"text-align: right;\">\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">[root@localhost ~]#chown mysql.root \/var\/log\/mysql_slow_queries.log<\/pre>\n<p>&nbsp;<\/p>\n<\/div>\n<h4 class=\"global-rtl\" dir=\"rtl\" style=\"text-align: right;\"><span style=\"color: #000080;\">5. \u0633\u0631\u0648\u06cc\u0633 mysql \u062e\u0648\u062f \u0631\u0627 \u0645\u062c\u062f\u062f \u0631\u0627\u0647 \u0627\u0646\u062f\u0627\u0632\u06cc \u06a9\u0646\u06cc\u062f:<\/span><\/h4>\n<div dir=\"ltr\" style=\"text-align: right;\">\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">[root@localhost ~]#service mysql restart<\/pre>\n<p>&nbsp;<\/p>\n<\/div>\n<h4 class=\"global-rtl\" dir=\"rtl\" style=\"text-align: right;\"><span style=\"color: #000080;\">6. \u062d\u0627\u0644\u0627 \u0645\u06cc \u062a\u0648\u0627\u0646\u06cc\u062f \u06a9\u0648\u0626\u0631\u06cc \u0647\u0627\u06cc \u06a9\u0646\u062f \u0631\u0627 \u0645\u0634\u0627\u0647\u062f\u0647 \u0646\u0645\u0627\u0626\u06cc\u062f\u060c &#8220;\u062d\u062a\u0645\u0627 \u0627\u0632 \u062f\u0633\u062a\u0648\u0631 \u0632\u06cc\u0631 \u0627\u0633\u062a\u0641\u0627\u062f\u0647 \u06a9\u0646\u06cc\u062f&#8221;\u060c \u0686\u0631\u0627 \u06a9\u0647 \u0645\u0645\u06a9\u0646 \u0627\u0633\u062a \u0641\u0627\u06cc\u0644 \u0645\u0631\u0628\u0648\u0637\u0647 \u062e\u06cc\u0644\u06cc \u0637\u0648\u0644\u0627\u0646\u06cc \u0648 \u062d\u062c\u06cc\u0645 \u0628\u0627\u0634\u062f:<\/span><\/h4>\n<div dir=\"ltr\" style=\"text-align: right;\">\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">[root@localhost ~]#tail -f \/var\/log\/mysql_slow_queries.log<\/pre>\n<p>&nbsp;<\/p>\n<\/div>\n<div dir=\"ltr\" style=\"text-align: right;\"><\/div>\n<div class=\"global-rtl\" dir=\"rtl\" style=\"text-align: right;\">* \u062d\u0627\u0644 \u0645\u06cc \u062a\u0648\u0627\u0646\u06cc\u062f \u06a9\u0648\u0626\u0631\u06cc \u0647\u0627\u06cc \u06a9\u0646\u062f mysql\u00a0 \u0631\u0627 \u0634\u0646\u0627\u0633\u0627\u06cc\u06cc \u0648 \u0628\u0631\u0627\u06cc \u0628\u0647\u06cc\u0646\u0647 \u0633\u0627\u0632\u06cc \u06cc\u0627 \u062d\u0630\u0641 \u0622\u0646 \u0627\u0642\u062f\u0627\u0645 \u0646\u0645\u0627\u0626\u06cc\u062f.<\/div>\n","protected":false},"excerpt":{"rendered":"<p>MySQL \u0645\u06cc \u062a\u0648\u0627\u0646\u062f \u06a9\u0648\u0626\u0631\u06cc \u0647\u0627\u06cc\u06cc ( queries ) \u00a0\u06a9\u0647 \u0627\u0632 \u06cc\u06a9 \u0645\u062f\u062a \u0632\u0645\u0627\u0646 \u0645\u0634\u062e\u0635 \u0645\u0627\u0646\u0646\u062f X \u0637\u0648\u0644\u0627\u0646\u06cc \u062a\u0631 \u0645\u06cc \u0634\u0648\u062f\u060c \u0631\u0627 \u062b\u0628\u062a \u0646\u0645\u0627\u06cc\u062f \u0648 \u06cc\u0627 \u0627\u0635\u0637\u0644\u0627\u062d\u0627 Log \u06a9\u0646\u062f. \u0627\u06cc\u0646 \u0627\u0645\u06a9\u0627\u0646 \u062f\u0631 \u062d\u0627\u0644\u062a \u0627\u0648\u0644\u06cc\u0647 ( default ) \u00a0\u063a\u06cc\u0631 \u0641\u0639\u0627\u0644 \u0645\u06cc \u0628\u0627\u0634\u062f. \u0647\u0645\u0627\u0646\u0637\u0648\u0631 \u06a9\u0647 \u0645\u06cc \u062f\u0627\u0646\u06cc\u062f \u06a9\u0648\u0626\u0631\u06cc \u0647\u0627\u06cc \u06a9\u0646\u062f mysql \u0645\u0646\u062c\u0631 \u0628\u0647 \u06a9\u0646\u062f \u0634\u062f\u0646 \u0633\u0631\u0648\u0631 \u0634\u0645\u0627 \u0645\u06cc [&hellip;]<\/p>\n","protected":false},"author":87,"featured_media":35728,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[22],"tags":[],"class_list":["post-2057","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-learn-server"],"post_mailing_queue_ids":[],"_links":{"self":[{"href":"https:\/\/parspack.com\/blog\/wp-json\/wp\/v2\/posts\/2057","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/parspack.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/parspack.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/parspack.com\/blog\/wp-json\/wp\/v2\/users\/87"}],"replies":[{"embeddable":true,"href":"https:\/\/parspack.com\/blog\/wp-json\/wp\/v2\/comments?post=2057"}],"version-history":[{"count":1,"href":"https:\/\/parspack.com\/blog\/wp-json\/wp\/v2\/posts\/2057\/revisions"}],"predecessor-version":[{"id":50380,"href":"https:\/\/parspack.com\/blog\/wp-json\/wp\/v2\/posts\/2057\/revisions\/50380"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/parspack.com\/blog\/wp-json\/wp\/v2\/media\/35728"}],"wp:attachment":[{"href":"https:\/\/parspack.com\/blog\/wp-json\/wp\/v2\/media?parent=2057"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/parspack.com\/blog\/wp-json\/wp\/v2\/categories?post=2057"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/parspack.com\/blog\/wp-json\/wp\/v2\/tags?post=2057"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}