{"id":473,"date":"2010-01-17T08:44:44","date_gmt":"2010-01-17T12:44:44","guid":{"rendered":"http:\/\/linuxhostingsupport.net\/blog\/?p=473"},"modified":"2013-03-20T08:42:24","modified_gmt":"2013-03-20T12:42:24","slug":"how-to-enable-general-query-log-in-mysql","status":"publish","type":"post","link":"https:\/\/linuxhostingsupport.net\/blog\/how-to-enable-general-query-log-in-mysql","title":{"rendered":"How to enable &#8216;General Query Log&#8217; in Mysql?"},"content":{"rendered":"<p><strong>General Query Log is used to keep track of mysql status i.e. it writes the information when a client connects\/disconnects OR a query is executed.<\/strong> It is useful when the number of people managing the database is high. In order to enable &#8216;General Query Log&#8217;,<\/p>\n<p>edit the Mysql configuration file<\/p>\n<blockquote><p><span style=\"color: #0000ff;\"><strong>vi \/etc\/my.cnf<\/strong><\/span><\/p><\/blockquote>\n<p>enable the log under the &#8216;mysqld&#8217; section<\/p>\n<blockquote><p><span style=\"color: #0000ff;\"><strong>log=\/var\/log\/mysql.general.log<\/strong><\/span><\/p><\/blockquote>\n<p>Save the file. Now create the log file and set the mysql ownership<\/p>\n<blockquote><p><span style=\"color: #0000ff;\"><strong>touch \/var\/log\/mysql.general.log<br \/>\nchown mysql.mysql \/var\/log\/mysql.general.log<\/strong><\/span><\/p><\/blockquote>\n<p>Now, restart the mysql service<\/p>\n<blockquote><p><span style=\"color: #0000ff;\"><strong>\/etc\/init.d\/mysql restart<\/strong><\/span><\/p><\/blockquote>\n<p>You can now execute the queries using phpMyAdmin OR 3rd party sql software and watch the logs<\/p>\n<blockquote><p><span style=\"color: #0000ff;\"><strong>tail -f \/var\/log\/mysql.general.log<\/strong><\/span><\/p><\/blockquote>\n","protected":false},"excerpt":{"rendered":"<p>General Query Log is used to keep track of mysql status i.e. it writes the information when a client connects\/disconnects OR a query is executed. It is useful when the number of people managing the database is high. In order to enable &#8216;General Query Log&#8217;,<br \/>\nedit the Mysql configuration file<br \/>\nvi \/etc\/my.cnf<br \/>\nenable the log under the &#8216;mysqld&#8217; section<br \/>\nlog=\/var\/log\/mysql.general.log<br \/>\nSave the file. Now create the log file and set the mysql ownership<br \/>\ntouch \/var\/log\/mysql.general.log<br \/>\nchown mysql.mysql \/var\/log\/mysql.general.log<br \/>\nNow, restart the mysql service<br \/>\n\/etc\/init.d\/mysql restart<br \/>\nYou can now execute the queries using phpMyAdmin OR 3rd party sql software [&#8230;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[111],"tags":[649,652,651,653,650],"_links":{"self":[{"href":"https:\/\/linuxhostingsupport.net\/blog\/wp-json\/wp\/v2\/posts\/473"}],"collection":[{"href":"https:\/\/linuxhostingsupport.net\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/linuxhostingsupport.net\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/linuxhostingsupport.net\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/linuxhostingsupport.net\/blog\/wp-json\/wp\/v2\/comments?post=473"}],"version-history":[{"count":4,"href":"https:\/\/linuxhostingsupport.net\/blog\/wp-json\/wp\/v2\/posts\/473\/revisions"}],"predecessor-version":[{"id":2191,"href":"https:\/\/linuxhostingsupport.net\/blog\/wp-json\/wp\/v2\/posts\/473\/revisions\/2191"}],"wp:attachment":[{"href":"https:\/\/linuxhostingsupport.net\/blog\/wp-json\/wp\/v2\/media?parent=473"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/linuxhostingsupport.net\/blog\/wp-json\/wp\/v2\/categories?post=473"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/linuxhostingsupport.net\/blog\/wp-json\/wp\/v2\/tags?post=473"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}