{"id":6399,"date":"2024-11-14T14:14:32","date_gmt":"2024-11-14T06:14:32","guid":{"rendered":"https:\/\/fwq.ai\/blog\/6399\/"},"modified":"2024-11-14T14:14:32","modified_gmt":"2024-11-14T06:14:32","slug":"mysql%e6%97%a5%e5%bf%97%e5%9c%a8%e5%93%aa","status":"publish","type":"post","link":"https:\/\/fwq.ai\/blog\/6399\/","title":{"rendered":"mysql\u65e5\u5fd7\u5728\u54ea"},"content":{"rendered":"<blockquote><p>\n  mysql \u65e5\u5fd7\u901a\u5e38\u5b58\u50a8\u5728\u4ee5\u4e0b\u4f4d\u7f6e\uff1alinux\/unix \u7cfb\u7edf\uff1a\/var\/log\/mysqlwindows \u7cfb\u7edf\uff1a%programdata%mysqlmysql server x.ydata\u5176\u4ed6\u4f4d\u7f6e\u7531 &#8211;datadir \u9009\u9879\u6307\u5b9a\u3002\n<\/p><\/blockquote>\n<p><img decoding=\"async\" src=\"https:\/\/img.php.cn\/upload\/article\/202408\/01\/2024080121244961924.jpg\" class=\"aligncenter\" title=\"mysql\u65e5\u5fd7\u5728\u54ea\u63d2\u56fe\" alt=\"mysql\u65e5\u5fd7\u5728\u54ea\u63d2\u56fe\" \/><\/p>\n<p><strong>MySQL \u65e5\u5fd7\u4f4d\u7f6e<\/strong><\/p>\n<p>MySQL \u65e5\u5fd7\u901a\u5e38\u5b58\u50a8\u5728\u4ee5\u4e0b\u4f4d\u7f6e\uff1a<\/p>\n<p><strong>Linux\/UNIX \u7cfb\u7edf\uff1a<\/strong><\/p>\n<ul>\n<li>\/var\/log\/ <\/li>\n<\/ul>\n<p><strong>Windows \u7cfb\u7edf\uff1a<\/strong><\/p>\n<ul>\n<li>%PROGRAMDATA%MySQLMySQL Server x.yData<\/li>\n<\/ul>\n<p><strong>\u5176\u4ed6\u53ef\u80fd\u7684\u4f4d\u7f6e\uff1a<\/strong><\/p>\n<ul>\n<li>\u7531 &#8211;datadir \u9009\u9879\u6307\u5b9a\u7684\u81ea\u5b9a\u4e49\u6570\u636e\u76ee\u5f55<\/li>\n<\/ul>\n<p><strong>\u6587\u4ef6\u7c7b\u578b\uff1a<\/strong><\/p>\n<p>MySQL \u65e5\u5fd7\u4e3b\u8981\u7531\u4ee5\u4e0b\u6587\u4ef6\u7ec4\u6210\uff1a<\/p>\n<ul>\n<li> <strong>\u9519\u8bef\u65e5\u5fd7\uff08error.log\uff09\uff1a<\/strong>\u8bb0\u5f55\u9519\u8bef\u548c\u8b66\u544a\u4fe1\u606f\u3002<\/li>\n<li> <strong>\u901a\u7528\u67e5\u8be2\u65e5\u5fd7\uff08general.log\uff09\uff1a<\/strong>\u8bb0\u5f55\u6240\u6709\u67e5\u8be2\u8bed\u53e5\uff08\u9664\u975e\u7981\u7528\uff09\u3002<\/li>\n<li> <strong>\u6162\u67e5\u8be2\u65e5\u5fd7\uff08slow.log\uff09\uff1a<\/strong>\u8bb0\u5f55\u8d85\u8fc7\u6307\u5b9a\u65f6\u95f4\u9608\u503c\u7684\u67e5\u8be2\u3002<\/li>\n<li> <strong>\u4e8c\u8fdb\u5236\u65e5\u5fd7\uff08binlog\uff09\uff1a<\/strong>\u8bb0\u5f55\u6570\u636e\u5e93\u66f4\u6539\u4ee5\u8fdb\u884c\u590d\u5236\u3002<\/li>\n<li> <strong>\u4e2d\u7ee7\u65e5\u5fd7\uff08relaylog\uff09\uff1a<\/strong>\u5728\u590d\u5236\u4e2d\u7d99\u4e2d\u8d77\u5230\u4e2d\u95f4\u7f13\u51b2\u7684\u4f5c\u7528\u3002<\/li>\n<\/ul>\n<p><strong>\u5982\u4f55\u67e5\u627e MySQL \u65e5\u5fd7\uff1a<\/strong><\/p>\n<ol>\n<li>\u4f7f\u7528 SHOW DATABASES \u547d\u4ee4\u67e5\u770b\u6570\u636e\u5e93\u5217\u8868\u3002<\/li>\n<li>\u8fd0\u884c SELECT @@datadir \u67e5\u8be2\u4ee5\u83b7\u53d6\u6570\u636e\u76ee\u5f55\u7684\u8def\u5f84\u3002<\/li>\n<li>\u5bfc\u822a\u5230\u6570\u636e\u76ee\u5f55\uff0c\u627e\u5230\u76f8\u5e94\u7684\u65e5\u5fd7\u6587\u4ef6\u3002<\/li>\n<\/ol>\n<p><strong>\u5176\u4ed6\u6709\u7528\u4fe1\u606f\uff1a<\/strong><\/p>\n<ul>\n<li>\u65e5\u5fd7\u6587\u4ef6\u7684\u4f4d\u7f6e\u53ef\u4ee5\u5728 MySQL \u914d\u7f6e\u6587\u4ef6\u4e2d\u8fdb\u884c\u5b9a\u5236\uff08\u901a\u5e38\u662f my.cnf\uff09\u3002<\/li>\n<li>\u65e5\u5fd7\u8bb0\u5f55\u7ea7\u522b\u53ef\u4ee5\u901a\u8fc7 log-error\u3001log-queries-not-using-indexes \u548c log-slow-queries \u7b49\u914d\u7f6e\u9009\u9879\u63a7\u5236\u3002<\/li>\n<li>\u53ef\u4ee5\u4f7f\u7528 mysqldumpslow \u5de5\u5177\u5206\u6790\u6162\u67e5\u8be2\u65e5\u5fd7\u3002<\/li>\n<\/ul>\n<p>\u4ee5\u4e0a\u5c31\u662f\u65e5\u5fd7\u5728\u54ea\u7684\u8be6\u7ec6\u5185\u5bb9\uff0c\u66f4\u591a\u8bf7\u5173\u6ce8\u7c73\u4e91\u7f51\u5176\u5b83\u76f8\u5173\u6587\u7ae0\uff01<\/p>\n","protected":false},"excerpt":{"rendered":"<p>mysql \u65e5\u5fd7\u901a\u5e38\u5b58\u50a8\u5728\u4ee5\u4e0b\u4f4d\u7f6e\uff1alinux\/unix \u7cfb\u7edf\uff1a\/var\/log\/mysqlwindows \u7cfb\u7edf\uff1a%programdata%mysqlmysql server x.ydata\u5176\u4ed6\u4f4d\u7f6e\u7531 &#8211;datadir \u9009\u9879\u6307\u5b9a\u3002 MySQL \u65e5\u5fd7\u4f4d\u7f6e MySQL \u65e5\u5fd7\u901a\u5e38\u5b58\u50a8\u5728\u4ee5\u4e0b\u4f4d\u7f6e\uff1a Linux\/UNIX \u7cfb\u7edf\uff1a \/var\/log\/ Windows \u7cfb\u7edf\uff1a %PROGRAMDATA%MySQLMySQL Server x.yData \u5176\u4ed6\u53ef\u80fd\u7684\u4f4d\u7f6e\uff1a \u7531 &#8211;datadir \u9009\u9879\u6307\u5b9a\u7684\u81ea\u5b9a\u4e49\u6570\u636e\u76ee\u5f55 \u6587\u4ef6\u7c7b\u578b\uff1a MySQL \u65e5\u5fd7\u4e3b\u8981\u7531\u4ee5\u4e0b\u6587\u4ef6\u7ec4\u6210\uff1a \u9519\u8bef\u65e5\u5fd7\uff08error.log\uff09\uff1a\u8bb0\u5f55\u9519\u8bef\u548c\u8b66\u544a\u4fe1\u606f\u3002 \u901a\u7528\u67e5\u8be2\u65e5\u5fd7\uff08general.log\uff09\uff1a\u8bb0\u5f55\u6240\u6709\u67e5\u8be2\u8bed\u53e5\uff08\u9664\u975e\u7981\u7528\uff09\u3002 \u6162\u67e5\u8be2\u65e5\u5fd7\uff08slow.log\uff09\uff1a\u8bb0\u5f55\u8d85\u8fc7\u6307\u5b9a\u65f6\u95f4\u9608\u503c\u7684\u67e5\u8be2\u3002 \u4e8c\u8fdb\u5236\u65e5\u5fd7\uff08binlog\uff09\uff1a\u8bb0\u5f55\u6570\u636e\u5e93\u66f4\u6539\u4ee5\u8fdb\u884c\u590d\u5236\u3002 \u4e2d\u7ee7\u65e5\u5fd7\uff08relaylog\uff09\uff1a\u5728\u590d\u5236\u4e2d\u7d99\u4e2d\u8d77\u5230\u4e2d\u95f4\u7f13\u51b2\u7684\u4f5c\u7528\u3002 \u5982\u4f55\u67e5\u627e MySQL \u65e5\u5fd7\uff1a \u4f7f\u7528 SHOW DATABASES \u547d\u4ee4\u67e5\u770b\u6570\u636e\u5e93\u5217\u8868\u3002 \u8fd0\u884c SELECT @@datadir \u67e5\u8be2\u4ee5\u83b7\u53d6\u6570\u636e\u76ee\u5f55\u7684\u8def\u5f84\u3002 \u5bfc\u822a\u5230\u6570\u636e\u76ee\u5f55\uff0c\u627e\u5230\u76f8\u5e94\u7684\u65e5\u5fd7\u6587\u4ef6\u3002 \u5176\u4ed6\u6709\u7528\u4fe1\u606f\uff1a \u65e5\u5fd7\u6587\u4ef6\u7684\u4f4d\u7f6e\u53ef\u4ee5\u5728 MySQL \u914d\u7f6e\u6587\u4ef6\u4e2d\u8fdb\u884c\u5b9a\u5236\uff08\u901a\u5e38\u662f my.cnf\uff09\u3002 \u65e5\u5fd7\u8bb0\u5f55\u7ea7\u522b\u53ef\u4ee5\u901a\u8fc7 log-error\u3001log-queries-not-using-indexes \u548c log-slow-queries \u7b49\u914d\u7f6e\u9009\u9879\u63a7\u5236\u3002 \u53ef\u4ee5\u4f7f\u7528 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[16],"tags":[],"class_list":["post-6399","post","type-post","status-publish","format-standard","hentry","category-16"],"_links":{"self":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/6399","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/comments?post=6399"}],"version-history":[{"count":0,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/6399\/revisions"}],"wp:attachment":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/media?parent=6399"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/categories?post=6399"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/tags?post=6399"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}