{"id":200174,"date":"2025-05-06T11:20:02","date_gmt":"2025-05-06T03:20:02","guid":{"rendered":"https:\/\/server.hk\/cnblog\/200174\/"},"modified":"2025-05-06T11:20:02","modified_gmt":"2025-05-06T03:20:02","slug":"%e5%a6%82%e4%bd%95%e9%80%9a%e8%bf%87%e5%91%bd%e4%bb%a4%e8%a1%8c%e5%af%bc%e5%87%ba-mysql-%e6%95%b0%e6%8d%ae%e5%ba%93%e7%9a%84-ddl%ef%bc%9f","status":"publish","type":"post","link":"https:\/\/server.hk\/cnblog\/200174\/","title":{"rendered":"\u5982\u4f55\u901a\u8fc7\u547d\u4ee4\u884c\u5bfc\u51fa MySQL \u6570\u636e\u5e93\u7684 DDL\uff1f"},"content":{"rendered":"<p><b><\/b> <\/p>\n<h1>\u5982\u4f55\u901a\u8fc7\u547d\u4ee4\u884c\u5bfc\u51fa MySQL \u6570\u636e\u5e93\u7684 DDL\uff1f<\/h1>\n<p>\u201c\u7eb5\u6709\u75be\u98ce\u6765\uff0c\u4eba\u751f\u4e0d\u8a00\u5f03\u201d\uff0c\u8fd9\u53e5\u8bdd\u9001\u7ed9\u6b63\u5728\u5b66\u4e60\u7684\u670b\u53cb\u4eec\uff0c\u4e5f\u5e0c\u671b\u5728\u9605\u8bfb\u672c\u6587\u540e\uff0c\u80fd\u591f\u771f\u7684\u5e2e\u52a9\u5230\u5927\u5bb6\u3002\u6211\u4e5f\u4f1a\u5728\u540e\u7eed\u7684\u6587\u7ae0\u4e2d\uff0c\u9646\u7eed\u66f4\u65b0\u76f8\u5173\u7684\u6280\u672f\u6587\u7ae0\uff0c\u6709\u597d\u7684\u5efa\u8bae\u6b22\u8fce\u5927\u5bb6\u5728\u8bc4\u8bba\u7559\u8a00\uff0c\u975e\u5e38\u611f\u8c22\uff01<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/www.17golang.com\/uploads\/20241027\/1729999661671db32dba957.jpg\" class=\"aligncenter\"><\/p>\n<p><strong>\u547d\u4ee4\u884c\u5bfc\u51fa mysql \u6570\u636e\u5e93 ddl<\/strong><\/p>\n<p><strong>\u95ee\u9898\uff1a<\/strong>\u5982\u4f55\u901a\u8fc7\u547d\u4ee4\u884c\u5bfc\u51fa mysql \u6570\u636e\u5e93\u53ca\u5176\u8868\u4e2d\u7684 ddl\uff08\u6570\u636e\u5b9a\u4e49\u8bed\u8a00\uff09\u4ee3\u7801\uff1f<\/p>\n<p><strong>\u89e3\u51b3\u65b9\u6848\uff1a<\/strong><\/p>\n<p>\u8981\u901a\u8fc7\u547d\u4ee4\u884c\u5bfc\u51fa ddl\uff0c\u53ef\u4ee5\u4f7f\u7528 mysql \u7684 show create table \u8bed\u53e5\u3002\u8be5\u8bed\u53e5\u7528\u4e8e\u663e\u793a\u521b\u5efa\u6307\u5b9a\u8868\u7684 ddl \u8bed\u53e5\u3002<\/p>\n<p><strong>\u6b65\u9aa4\uff1a<\/strong><\/p>\n<ol>\n<li>\u8fde\u63a5\u5230 mysql \u670d\u52a1\u5668\uff1a<\/li>\n<\/ol>\n<pre>mysql -u root -p<\/pre>\n<ol>\n<li>\u8f93\u5165\u5bc6\u7801\u5e76\u8fde\u63a5\u5230\u6570\u636e\u5e93\uff1a<\/li>\n<\/ol>\n<pre>use redmine;<\/pre>\n<ol>\n<li>\u5bf9\u4e8e\u8981\u5bfc\u51fa\u7684\u6bcf\u4e2a\u8868\uff0c\u8fd0\u884c\u4ee5\u4e0b\u547d\u4ee4\uff1a<\/li>\n<\/ol>\n<pre>show create table table_name;<\/pre>\n<p>\u8fd9\u5c06\u663e\u793a\u8868\u7684 ddl\u3002<\/p>\n<p><strong>\u793a\u4f8b\uff1a<\/strong><\/p>\n<p>\u4ee5\u4e0b\u547d\u4ee4\u5c06\u5bfc\u51fa t \u8868\u7684 ddl\uff1a<\/p>\n<pre>show create table t;<\/pre>\n<p>\u8fd9\u5c06\u8f93\u51fa\u4e00\u4e2a\u7c7b\u4f3c\u4e8e\u4ee5\u4e0b\u5185\u5bb9\u7684 ddl \u8bed\u53e5\uff1a<\/p>\n<pre>CREATE TABLE t (\n  `id` bigint PRIMARY KEY AUTO_INCREMENT,\n  `name` varchar(64)\n);<\/pre>\n<p>\u5bfc\u51fa\u7684 ddl \u53ef\u4ee5\u590d\u5236\u5230\u6587\u672c\u6587\u4ef6\u6216\u4fdd\u5b58\u5230\u53d8\u91cf\u4e2d\u4ee5\u4fbf\u8fdb\u4e00\u6b65\u4f7f\u7528\u3002<\/p>\n<p>\u5230\u8fd9\u91cc\uff0c\u6211\u4eec\u4e5f\u5c31\u8bb2\u5b8c\u4e86\u300a\u5982\u4f55\u901a\u8fc7\u547d\u4ee4\u884c\u5bfc\u51fa MySQL \u6570\u636e\u5e93\u7684 DDL\uff1f\u300b\u7684\u5185\u5bb9\u4e86\u3002\u4e2a\u4eba\u8ba4\u4e3a\uff0c\u57fa\u7840\u77e5\u8bc6\u7684\u5b66\u4e60\u548c\u5de9\u56fa\uff0c\u662f\u4e3a\u4e86\u66f4\u597d\u7684\u5c06\u5176\u8fd0\u7528\u5230\u9879\u76ee\u4e2d\uff0c\u6b22\u8fce\u5173\u6ce8\u4e3b\u673a\u5b9d\u8d1d\u516c\u4f17\u53f7\uff0c\u5e26\u4f60\u4e86\u89e3\u66f4\u591a\u5173\u4e8e\u7684\u77e5\u8bc6\u70b9\uff01<\/p>\n<p> \u7248\u672c\u58f0\u660e \u672c\u6587\u8f6c\u8f7d\u4e8e\uff1aphp \u5982\u6709\u4fb5\u72af\uff0c\u8bf7\u8054\u7cfb \u5220\u9664 <\/p>\n<dl>\n<dt>\n <\/dt>\n<\/dl>\n","protected":false},"excerpt":{"rendered":"<p>\u5982\u4f55\u901a\u8fc7\u547d\u4ee4\u884c\u5bfc\u51fa MySQL &#46;&#46;&#46;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[101],"tags":[],"class_list":["post-200174","post","type-post","status-publish","format-standard","hentry","category-database"],"_links":{"self":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/200174","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/comments?post=200174"}],"version-history":[{"count":0,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/200174\/revisions"}],"wp:attachment":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/media?parent=200174"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/categories?post=200174"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/tags?post=200174"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}