\u53ef\u4ee5\u770b\u5230\uff0c\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u72ec\u7acb\u8868\u7a7a\u95f4\u662f\u5f00\u542f\u7684\u3002<\/p>\n
\u8fd9\u4e2a\u65f6\u5019\u6211\u4eec\u6765\u521b\u5efa\u4e00\u4e2a\u4f7f\u7528\u4e86 InnoDB \u5f15\u64ce\u7684\u8868\uff0c\u5982\u4e0b(\u9ed8\u8ba4\u5b58\u50a8\u5f15\u64ce\u5c31\u662f InnoDB)\uff1a<\/p>\n
create table book(id int,name varchar(255)); \r\n<\/pre>\n<\/p>\n
\u521b\u5efa\u5b8c\u6210\u540e\uff0c\u6211\u4eec\u6765\u5230\u5b58\u653e\u6570\u636e\u6587\u4ef6\u7684\u76ee\u5f55\u4e0b\uff0c\u53ef\u4ee5\u770b\u5230\u5982\u4e0b\u6587\u4ef6\uff1a<\/p>\n
<\/p>\n
\u53ef\u4ee5\u770b\u5230\uff0c\u5f53\u524d\u8868\u88ab\u5b58\u653e\u5728\u72ec\u7acb\u7684 book.ibd \u6587\u4ef6\u4e2d\u3002<\/p>\n
\u5b58\u653e\u4e8e\u72ec\u7acb\u8868\u7a7a\u95f4\u7684\u8868\u90fd\u5c06\u4f1a\u4ee5\u72ec\u7acb\u6587\u4ef6\u7684\u65b9\u5f0f\u6765\u8fdb\u884c\u5b58\u50a8\uff0c\u6bcf\u4e00\u4e2a\u8868\u90fd\u6709\u4e00\u4e2a .frm \u8868\u63cf\u8ff0\u6587\u4ef6(\u8fd9\u4e2a\u548c MyISAM \u5f15\u64ce\u4e00\u81f4)\uff0c\u8fd8\u6709\u4e00\u4e2a .ibd \u6587\u4ef6\uff0c\u8fd9\u4e2a\u6587\u4ef6\u5305\u62ec\u4e86\u5355\u72ec\u4e00\u4e2a\u8868\u7684\u6570\u636e\u5185\u5bb9\u4ee5\u53ca\u7d22\u5f15\u5185\u5bb9\uff0c\u9ed8\u8ba4\u60c5\u51b5\u4e0b\u5b83\u7684\u5b58\u50a8\u4f4d\u7f6e\u4e5f\u662f\u5728\u8868\u7684\u4f4d\u7f6e\u4e4b\u4e2d\u3002<\/p>\n
\u63a5\u4e0b\u6765\u6211\u4eec\u6267\u884c\u5982\u4e0b\u4ee3\u7801\uff0c\u4fee\u6539 innodb_file_per_table \u7684\u503c\u4e3a OFF\uff0c\u5373\u5173\u95ed\u72ec\u7acb\u8868\u7a7a\u95f4\uff0c\u5982\u4e0b\uff1a<\/p>\n
<\/p>\n
\u5173\u95ed\u4e4b\u540e\uff0c\u518d\u6765\u521b\u5efa\u65b0\u8868\uff1a<\/p>\n
create table book2(id int,name varchar(255));<\/pre>\n\u65b0\u8868\u521b\u5efa\u6210\u529f\u4e4b\u540e\uff0c\u6b64\u65f6\u6211\u4eec\u518d\u53bb\u8868\u76ee\u5f55\u4e0b\u67e5\u770b\u6587\u4ef6\uff0c\u53d1\u73b0\u5e76\u6ca1\u6709\u4e00\u4e2a\u540d\u4e3a book2.ibd \u7684\u6587\u4ef6\uff0c\u8bf4\u660e\u6b64\u65f6\u7684\u8868\u5df2\u7ecf\u5b58\u653e\u4e8e\u5171\u4eab\u8868\u7a7a\u95f4\u4e86\u3002<\/p>\n
\u90a3\u4e48\u5171\u4eab\u8868\u7a7a\u95f4\u7684 ibdata1 \u6587\u4ef6\u53c8\u5728\u54ea\u91cc\u5462?\u5176\u5b9e\u5c31\u5728 MySQL \u5b58\u653e\u6570\u636e\u5e93\u7684\u76ee\u5f55\u4e0b\uff1a<\/p>\n
<\/p>\n
\u6211\u4eec\u53ef\u4ee5\u901a\u8fc7\u5982\u4e0b\u547d\u4ee4\u67e5\u770b ibdata1 \u7684\u9ed8\u8ba4\u5927\u5c0f\uff1a<\/p>\n
show variables like 'innodb_data_file_path';<\/pre>\n<\/p>\n
\u53ef\u4ee5\u770b\u5230\uff0c\u9ed8\u8ba4\u5927\u5c0f\u662f 12M\u3002<\/p>\n
\u9700\u8981\u6ce8\u610f\u7684\u662f\uff0cinnodb_file_per_table \u8981\u5728\u521b\u5efa\u8868\u4e4b\u524d\u4fee\u6539\uff0c\u521b\u5efa\u8868\u4e4b\u540e\u518d\u53bb\u4fee\u6539\uff0c\u662f\u4e0d\u4f1a\u5f71\u54cd\u5df2\u6709\u7684\u8868\u7ed3\u6784\u7684\u3002<\/p>\n
2.\u8be5\u7528\u54ea\u4e00\u4e2a?<\/strong><\/span><\/div>\n\u8981\u641e\u660e\u767d\u8981\u7528\u54ea\u4e00\u79cd\u8868\u7a7a\u95f4\uff0c\u6211\u4eec\u5f97\u5148\u660e\u767d\u4e24\u79cd\u4e0d\u540c\u8868\u7a7a\u95f4\u5404\u81ea\u7684\u7279\u70b9\u3002<\/p>\n
2.1 \u72ec\u7acb\u8868\u7a7a\u95f4<\/strong><\/p>\n\u4f18\u52bf<\/p>\n
\n- \u6bcf\u5f20\u8868\u90fd\u6709\u81ea\u5df1\u72ec\u7acb\u7684\u8868\u7a7a\u95f4\u3002<\/li>\n
- \u6bcf\u5f20\u8868\u7684\u6570\u636e\u548c\u7d22\u5f15\u90fd\u4f1a\u5b58\u50a8\u5728\u81ea\u5df1\u7684\u8868\u7a7a\u95f4\u4e2d\u3002<\/li>\n
- \u53ef\u4ee5\u5b9e\u73b0\u5355\u8868\u5728\u4e0d\u540c\u7684\u6570\u636e\u5e93\u4e2d\u79fb\u52a8(\u56e0\u4e3a\u6bcf\u5f20\u8868\u90fd\u6709\u72ec\u7acb\u7684\u6570\u636e\u8868\u6587\u4ef6)\u3002<\/li>\n
- \u7a7a\u95f4\u53ef\u4ee5\u56de\u6536(\u901a\u8fc7 optimize table \u547d\u4ee4\u5b9e\u73b0)\u3002<\/li>\n
- \u65e0\u8bba\u600e\u4e48\u5220\u9664\uff0c\u8868\u7a7a\u95f4\u7684\u788e\u7247\u4e0d\u4f1a\u592a\u4e25\u91cd\u5f71\u54cd\u7cfb\u7edf\u6027\u80fd\u3002<\/li>\n<\/ol>\n
\u7f3a\u70b9<\/p>\n
\n- \u5355\u8868\u589e\u52a0\u8fc7\u5927\u3002<\/li>\n<\/ol>\n
2.2 \u5171\u4eab\u8868\u7a7a\u95f4<\/strong><\/p>\n\u4f18\u52bf<\/p>\n
\n- \u53ef\u4ee5\u5c06\u8868\u7a7a\u95f4\u5206\u6210\u591a\u4e2a\u6587\u4ef6\u5b58\u653e\u5230\u5404\u4e2a\u78c1\u76d8\u4e0a(\u8868\u7a7a\u95f4\u6587\u4ef6\u5927\u5c0f\u4e0d\u53d7\u8868\u5927\u5c0f\u7684\u9650\u5236\uff0c\u5982\u4e00\u4e2a\u8868\u53ef\u4ee5\u5206\u5e03\u5728\u4e0d\u540c\u7684\u6587\u4ef6\u4e0a)\u3002<\/li>\n
- \u6570\u636e\u548c\u6587\u4ef6\u653e\u5728\u4e00\u8d77\u65b9\u4fbf\u7ba1\u7406\u3002<\/li>\n<\/ol>\n
\u7f3a\u70b9<\/p>\n
\n- \u6240\u6709\u7684\u6570\u636e\u548c\u7d22\u5f15\u5b58\u653e\u5230\u4e00\u4e2a\u6587\u4ef6\u4e2d\uff0c\u8fd9\u5c06\u610f\u5473\u7740\u6709\u4e00\u4e2a\u5f88\u5927\u7684\u6587\u4ef6\u5b58\u5728(\u867d\u7136\u53ef\u4ee5\u628a\u4e00\u4e2a\u5927\u6587\u4ef6\u5206\u6210\u591a\u4e2a\u5c0f\u6587\u4ef6)\uff0c\u4f46\u662f\u591a\u4e2a\u8868\u53ca\u7d22\u5f15\u5728\u8868\u7a7a\u95f4\u4e2d\u6df7\u5408\u5b58\u50a8\uff0c\u8fd9\u6837\u5f53\u4e00\u4e2a\u8868\u505a\u4e86\u5927\u91cf\u5220\u9664\u64cd\u4f5c\u540e\u8868\u7a7a\u95f4\u4e2d\u5c06\u4f1a\u6709\u5927\u91cf\u7684\u7a7a\u9699\uff0c\u7279\u522b\u662f\u5bf9\u4e8e\u7edf\u8ba1\u5206\u6790\u3001\u65e5\u5fd7\u7cfb\u7edf\u8fd9\u7c7b\u5e94\u7528\u800c\u8a00\uff0c\u6700\u4e0d\u9002\u5408\u7528\u5171\u4eab\u8868\u7a7a\u95f4(\u4f8b\u5982\uff0c\u5f53\u7cfb\u7edf\u7a7a\u95f4\u4e0d\u591f\u7528\u7684\u65f6\u5019\uff0c\u6211\u4eec\u5e0c\u671b\u901a\u8fc7\u5220\u9664\u4e00\u4e9b\u65e0\u6548\u6570\u636e\u6765\u817e\u51fa\u6765\u4e00\u4e9b\u8868\u7a7a\u95f4\uff0c\u8fd9\u4e2a\u65f6\u5019\u6211\u4eec\u4f1a\u53d1\u73b0\uff0c\u5982\u679c\u4f7f\u7528\u4e86\u5171\u4eab\u8868\u7a7a\u95f4\uff0c\u5373\u4f7f\u65e0\u6548\u6570\u636e\u5220\u9664\u4e86\uff0c\u8868\u7a7a\u95f4\u8fd8\u662f\u8fd8\u662f\u4e0d\u4f1a\u7f29\u5c0f)\u3002<\/li>\n
- \u5171\u4eab\u8868\u7a7a\u95f4\u7ba1\u7406\u4f1a\u51fa\u73b0\u8868\u7a7a\u95f4\u5206\u914d\u540e\u4e0d\u80fd\u56de\u7f29\u7684\u95ee\u9898\uff0c\u5f53\u4e34\u65f6\u5efa\u7acb\u7d22\u5f15\u6216\u8005\u4e34\u65f6\u8868\u5bfc\u81f4\u8868\u7a7a\u95f4\u6269\u5927\u540e\uff0c\u5c31\u662f\u5220\u9664\u76f8\u5173\u7684\u8868\u4e5f\u6ca1\u529e\u6cd5\u56de\u7f29\u90a3\u90e8\u5206\u7a7a\u95f4\u4e86\u3002<\/li>\n
- \u5bf9\u4e8e\u7b2c\u4e8c\u70b9\u5b58\u5728\u7684\u95ee\u9898\uff0c\u4e00\u822c\u4f7f\u7528 mysqldump \u5bfc\u51fa\u6570\u636e\uff0c\u7136\u540e\u5220\u9664\u5171\u4eab\u8868\u7a7a\u95f4\u6570\u636e\u6587\u4ef6\u540e\uff0c\u518d\u91cd\u65b0\u5bfc\u5165\u3002<\/li>\n
- \u7531\u4e8e\u4e00\u4e2a\u6587\u4ef6\u4e2d\u4fdd\u5b58\u4e86\u591a\u4e2a\u8868\u6570\u636e\uff0c\u6240\u4ee5\u5e76\u53d1\u64cd\u4f5c\u65f6\u53ef\u80fd\u4f1a\u4ea7\u751f IO \u74f6\u9888\uff0c\u6240\u4ee5\u9700\u8981\u9891\u7e41\u5199\u5165\u7684\u573a\u666f\u5e76\u4e0d\u9002\u5408\u5171\u4eab\u8868\u7a7a\u95f4\u3002<\/li>\n<\/ol>\n
\u7ecf\u8fc7\u4ee5\u4e0a\u7684\u5206\u6790\uff0c\u76f8\u4fe1\u5c0f\u4f19\u4f34\u4eec\u5df2\u7ecf\u660e\u767d\u4e86\uff0c\u5728\u5b9e\u9645\u9879\u76ee\u4e2d\uff0c\u8fd8\u662f\u9996\u9009\u72ec\u7acb\u8868\u7a7a\u95f4\u6bd4\u8f83\u597d\uff0c\u4e8b\u5b9e\u4e0a\uff0c\u4ece MySQL5.6 \u5f00\u59cb\uff0c\u72ec\u7acb\u8868\u7a7a\u95f4\u5c31\u5df2\u7ecf\u6210\u4e3a\u9ed8\u8ba4\u9009\u9879\u4e86\u3002<\/p>\n
3.\u8fc1\u79fb<\/strong><\/span><\/div>\n\u6700\u540e\u8fd8\u6709\u4e00\u4e2a\u95ee\u9898\uff0c\u5982\u679c\u4e00\u5f00\u59cb\u521b\u5efa\u7684\u662f\u5171\u4eab\u8868\u7a7a\u95f4\uff0c\u90a3\u4e48\u8fd8\u80fd\u8fc1\u79fb\u5230\u72ec\u7acb\u8868\u7a7a\u95f4\u5417?\u5f53\u7136\u53ef\u4ee5!\u53c2\u8003\u5982\u4e0b\u56db\u4e2a\u6b65\u9aa4\uff1a<\/p>\n
\n- \u4f7f\u7528 mysqldump \u5bfc\u51fa\u6240\u6709\u6570\u636e\u5e93\u8868\u6570\u636e\u3002<\/li>\n
- \u505c\u6b62 MySQL \u670d\u52a1\uff0c\u4fee\u6539 innodb_file_per_table \u53c2\u6570\uff0c\u5e76\u5220\u9664 InnoDB \u76f8\u5173\u6587\u4ef6(\u5982\u679c\u662f\u4e3b\u4ece\u7ed3\u6784\uff0c\u5219\u53ef\u4ee5\u4ece Slave \u4e0a\u5165\u624b\u5b8c\u6210\u8fd9\u4e9b\u64cd\u4f5c)\u3002<\/li>\n
- \u91cd\u542f MySQL \u670d\u52a1\uff0c\u91cd\u5efa InnoDB \u5171\u4eab\u8868\u7a7a\u95f4(\u6b64\u65f6\u91cc\u8fb9\u5c31\u6ca1\u6709\u6570\u636e\u4e86)\u3002<\/li>\n
- \u91cd\u65b0\u5bfc\u5165\u6570\u636e\u3002<\/li>\n<\/ol>\n
\u597d\u5566\uff0c\u4eca\u5929\u5c31\u548c\u5c0f\u4f19\u4f34\u4eec\u804a\u4e00\u804a\u5171\u4eab\u8868\u7a7a\u95f4\u548c\u72ec\u7acb\u8868\u7a7a\u95f4\uff0cInnoDB \u7684\u5176\u4ed6\u73a9\u6cd5\u6211\u4eec\u540e\u9762\u518d\u7ee7\u7eed\u4ecb\u7ecd\uff5e<\/p>\n","protected":false},"excerpt":{"rendered":"
\u6211\u4eec\u4eca\u5929\u5c31\u5f00\u59cb\u5b66\u4e60 MySQL \u4e2d\u53e6\u5916\u4e00\u4e2a\u975e\u5e38\u91cd\u8981\u7684\u5b58\u50a8\u5f15\u64ce InnoDB \u4e86\u3002 \u8981\u8bf4 InnoDB\uff0c\u6211\u4eec\u5c31\u4e0d […]<\/p>\n","protected":false},"author":317,"featured_media":208759,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[55],"tags":[],"class_list":["post-222562","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-thread"],"acf":[],"_links":{"self":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/222562","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/users\/317"}],"replies":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/comments?post=222562"}],"version-history":[{"count":3,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/222562\/revisions"}],"predecessor-version":[{"id":222586,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/222562\/revisions\/222586"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/media\/208759"}],"wp:attachment":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/media?parent=222562"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/categories?post=222562"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/tags?post=222562"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}