{"id":6713,"date":"2024-11-14T11:49:06","date_gmt":"2024-11-14T03:49:06","guid":{"rendered":"https:\/\/fwq.ai\/blog\/6713\/"},"modified":"2024-11-14T11:49:06","modified_gmt":"2024-11-14T03:49:06","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:\/\/fwq.ai\/blog\/6713\/","title":{"rendered":"\u5982\u4f55\u901a\u8fc7\u547d\u4ee4\u884c\u5bfc\u51fa MySQL \u6570\u636e\u5e93\u7684 DDL\uff1f"},"content":{"rendered":"<p><img decoding=\"async\" src=\"https:\/\/img.php.cn\/upload\/article\/001\/246\/273\/172977590035442.jpg\" class=\"aligncenter\" title=\"\u5982\u4f55\u901a\u8fc7\u547d\u4ee4\u884c\u5bfc\u51fa MySQL \u6570\u636e\u5e93\u7684 DDL\uff1f\u63d2\u56fe\" alt=\"\u5982\u4f55\u901a\u8fc7\u547d\u4ee4\u884c\u5bfc\u51fa MySQL \u6570\u636e\u5e93\u7684 DDL\uff1f\u63d2\u56fe\" \/><\/p>\n<p><strong>\u547d\u4ee4\u884c\u5bfc\u51fa  \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<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\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<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\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> \u767b\u5f55\u540e\u590d\u5236 <\/p>\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> \u767b\u5f55\u540e\u590d\u5236 <\/p>\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> \u767b\u5f55\u540e\u590d\u5236 <\/p>\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>\u4ee5\u4e0a\u5c31\u662f\u5982\u4f55\u901a\u8fc7\u547d\u4ee4\u884c\u5bfc\u51fa MySQL \u6570\u636e\u5e93\u7684 DDL\uff1f\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>\u547d\u4ee4\u884c\u5bfc\u51fa \u6570\u636e\u5e93 ddl \u95ee\u9898\uff1a\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 \u89e3\u51b3\u65b9\u6848\uff1a \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 \u6b65\u9aa4\uff1a \u8fde\u63a5\u5230 mysql \u670d\u52a1\u5668\uff1a mysql -u root -p \u767b\u5f55\u540e\u590d\u5236 \u8f93\u5165\u5bc6\u7801\u5e76\u8fde\u63a5\u5230\u6570\u636e\u5e93\uff1a use redmine; \u767b\u5f55\u540e\u590d\u5236 \u5bf9\u4e8e\u8981\u5bfc\u51fa\u7684\u6bcf\u4e2a\u8868\uff0c\u8fd0\u884c\u4ee5\u4e0b\u547d\u4ee4\uff1a show create table table_name; \u767b\u5f55\u540e\u590d\u5236 \u8fd9\u5c06\u663e\u793a\u8868\u7684 ddl\u3002 \u793a\u4f8b\uff1a \u4ee5\u4e0b\u547d\u4ee4\u5c06\u5bfc\u51fa t \u8868\u7684 ddl\uff1a show create table t; \u767b\u5f55\u540e\u590d\u5236 \u8fd9\u5c06\u8f93\u51fa\u4e00\u4e2a\u7c7b\u4f3c\u4e8e\u4ee5\u4e0b\u5185\u5bb9\u7684 ddl \u8bed\u53e5\uff1a CREATE TABLE t [&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-6713","post","type-post","status-publish","format-standard","hentry","category-16"],"_links":{"self":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/6713","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=6713"}],"version-history":[{"count":0,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/6713\/revisions"}],"wp:attachment":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/media?parent=6713"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/categories?post=6713"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/tags?post=6713"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}