{"id":944,"date":"2019-03-21T13:23:52","date_gmt":"2019-03-21T22:23:52","guid":{"rendered":"\/blog\/?p=944"},"modified":"2023-09-21T09:37:25","modified_gmt":"2023-09-21T00:37:25","slug":"mysql-%ec%bf%bc%eb%a6%ac-%eb%aa%a8%eb%8b%88%ed%84%b0%eb%a7%81","status":"publish","type":"post","link":"https:\/\/hasu0707.duckdns.org\/blog\/?p=944","title":{"rendered":"MySQL \ucffc\ub9ac \ubaa8\ub2c8\ud130\ub9c1"},"content":{"rendered":"\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"sql\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">-- --------------------------------------------------------------------\n--\n-- \ubaa8\ub4e0 \ucffc\ub9ac\uac00 mysql.general_log\uc5d0 \uc800\uc7a5\ub418\ub3c4\ub85d \uae00\ub85c\ubc8c \ubcc0\uc218 \uc14b\ud305\n--\n-- --------------------------------------------------------------------\nSET GLOBAL slow_query_log='ON';\nSET GLOBAL log_output='TABLE';\nSET GLOBAL general_log='ON';\nSHOW VARIABLES LIKE '%general_log%';\n\n-- --------------------------------------------------------------------\n--\n-- \ubaa8\ub4e0 \ucffc\ub9ac\uac00 C:\\mysql_query_monitor.sql \ud30c\uc77c\uc5d0 \uc800\uc7a5\ub418\ub3c4\ub85d \uc14b\ud305\n--\n-- --------------------------------------------------------------------\nSET GLOBAL general_log_file='C:\\\\mysql_query_monitor.sql';\nSET GLOBAL general_log_file='\/var\/lib\/mysql\/mysql_query_monitor.sql';\nSET GLOBAL log_output='FILE';\nSET GLOBAL slow_query_log='ON';\nSET GLOBAL general_log='ON';\nSHOW VARIABLES LIKE '%general_log%';\nSHOW VARIABLES LIKE '%log_output%';\n\n-- --------------------------------------------------------------------\n--\n-- \ubaa8\ub2c8\ud130\ub9c1 \uc911\uc9c0\n--\n-- --------------------------------------------------------------------\nSET GLOBAL slow_query_log='OFF';\nSET GLOBAL general_log='OFF';\nTRUNCATE TABLE mysql.general_log;\nCOMMIT;\n\n-- --------------------------------------------------------------------\n--\n-- root \uacc4\uc815\uc5d0 \ub300\ud574 mysql Database \uc811\uadfc\uad8c\ud55c \uc8fc\uae30\n--\n-- --------------------------------------------------------------------\nGRANT ALL PRIVILEGES ON mysql.* TO 'root'@'%' IDENTIFIED BY 'mypassword' WITH GRANT OPTION;\n\n-- --------------------------------------------------------------------\n--\n-- INSERT \ucffc\ub9ac\ub9cc \ubcf4\uae30\n--\n-- --------------------------------------------------------------------\nSELECT EVENT_TIME,\n       ARGUMENT\nFROM mysql.general_log\nWHERE COMMAND_TYPE=\"Query\"\n  AND ARGUMENT LIKE \"INSERT%\"\nORDER BY EVENT_TIME DESC\nLIMIT 100;\n\n-- --------------------------------------------------------------------\n--\n-- UPDATE \ucffc\ub9ac\ub9cc \ubcf4\uae30\n--\n-- --------------------------------------------------------------------\nSELECT EVENT_TIME,\n       ARGUMENT\nFROM mysql.general_log\nWHERE COMMAND_TYPE=\"Query\"\n  AND ARGUMENT LIKE \"UPDATE%\"\nORDER BY EVENT_TIME DESC\nLIMIT 100;\n\n-- --------------------------------------------------------------------\n--\n-- UPDATE+INSERT \ucffc\ub9ac\ub9cc \ubcf4\uae30\n--\n-- --------------------------------------------------------------------\nSELECT EVENT_TIME,\n       ARGUMENT\nFROM mysql.general_log\nWHERE COMMAND_TYPE=\"Query\"\n  AND (ARGUMENT LIKE \"UPDATE%\"\n       OR ARGUMENT LIKE \"INSERT%\")\nORDER BY EVENT_TIME DESC\nLIMIT 100;\n\n-- --------------------------------------------------------------------\n--\n-- \ubaa8\ub4e0 \ucffc\ub9ac \ubcf4\uae30\n--\n-- --------------------------------------------------------------------\nSELECT EVENT_TIME,\n       ARGUMENT\nFROM mysql.general_log\nWHERE COMMAND_TYPE=\"Query\"\nORDER BY EVENT_TIME DESC\nLIMIT 100;<\/pre>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"","protected":false},"author":2,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_import_markdown_pro_load_document_selector":0,"_import_markdown_pro_submit_text_textarea":"","site-sidebar-layout":"default","site-content-layout":"","ast-site-content-layout":"","site-content-style":"default","site-sidebar-style":"default","ast-global-header-display":"","ast-banner-title-visibility":"","ast-main-header-display":"","ast-hfb-above-header-display":"","ast-hfb-below-header-display":"","ast-hfb-mobile-header-display":"","site-post-title":"","ast-breadcrumbs-content":"","ast-featured-img":"","footer-sml-layout":"","theme-transparent-header-meta":"","adv-header-id-meta":"","stick-header-meta":"","header-above-stick-meta":"","header-main-stick-meta":"","header-below-stick-meta":"","astra-migrate-meta-layouts":"default","ast-page-background-enabled":"default","ast-page-background-meta":{"desktop":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"ast-content-background-meta":{"desktop":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"footnotes":""},"categories":[10],"tags":[],"class_list":["post-944","post","type-post","status-publish","format-standard","hentry","category-computing_database"],"_links":{"self":[{"href":"https:\/\/hasu0707.duckdns.org\/blog\/index.php?rest_route=\/wp\/v2\/posts\/944","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/hasu0707.duckdns.org\/blog\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/hasu0707.duckdns.org\/blog\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/hasu0707.duckdns.org\/blog\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/hasu0707.duckdns.org\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=944"}],"version-history":[{"count":0,"href":"https:\/\/hasu0707.duckdns.org\/blog\/index.php?rest_route=\/wp\/v2\/posts\/944\/revisions"}],"wp:attachment":[{"href":"https:\/\/hasu0707.duckdns.org\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=944"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/hasu0707.duckdns.org\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=944"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/hasu0707.duckdns.org\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=944"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}