{"id":217801,"date":"2023-12-23T00:29:25","date_gmt":"2023-12-22T16:29:25","guid":{"rendered":"https:\/\/www.idc.net\/help\/217801\/"},"modified":"2023-12-23T00:29:25","modified_gmt":"2023-12-22T16:29:25","slug":"mysql%e4%bd%bf%e7%94%a8%e6%89%8b%e5%86%8c%ef%bc%9a%e4%bd%bf%e7%94%a8rename-table-table1-to-table2%e9%87%8d%e5%91%bd%e5%90%8d%e8%a1%a8","status":"publish","type":"post","link":"https:\/\/idc.net\/help\/217801\/","title":{"rendered":"MySQL\u4f7f\u7528\u624b\u518c\uff1a\u4f7f\u7528RENAME TABLE table1 TO table2\u91cd\u547d\u540d\u8868"},"content":{"rendered":"<p><title id=\"mysql%e4%bd%bf%e7%94%a8%e6%89%8b%e5%86%8c%ef%bc%9a%e4%bd%bf%e7%94%a8rename-table-table1-to-table2%e9%87%8d%e5%91%bd%e5%90%8d%e8%a1%a8-gANpZehSqf\">MySQL\u4f7f\u7528\u624b\u518c\uff1a\u4f7f\u7528RENAME TABLE table1 TO table2\u91cd\u547d\u540d\u8868<\/title><\/p>\n<h1 id=\"mysql%e4%bd%bf%e7%94%a8%e6%89%8b%e5%86%8c%ef%bc%9a%e4%bd%bf%e7%94%a8rename-table-table1-to-table2%e9%87%8d%e5%91%bd%e5%90%8d%e8%a1%a8-gANpZehSqf\">MySQL\u4f7f\u7528\u624b\u518c\uff1a\u4f7f\u7528RENAME TABLE table1 TO table2\u91cd\u547d\u540d\u8868<\/h1>\n<p>\u5728MySQL\u4e2d\uff0cRENAME TABLE\u8bed\u53e5\u7528\u4e8e\u91cd\u547d\u540d\u4e00\u4e2a\u6216\u591a\u4e2a\u8868\u3002\u901a\u8fc7\u4f7f\u7528RENAME TABLE\u8bed\u53e5\uff0c\u60a8\u53ef\u4ee5\u66f4\u6539\u8868\u7684\u540d\u79f0\uff0c\u800c\u4e0d\u4f1a\u5f71\u54cd\u8868\u7684\u7ed3\u6784\u6216\u6570\u636e\u3002<\/p>\n<h2 id=\"%e8%af%ad%e6%b3%95-gANpZehSqf\">\u8bed\u6cd5<\/h2>\n<p>RENAME TABLE\u8bed\u53e5\u7684\u57fa\u672c\u8bed\u6cd5\u5982\u4e0b\uff1a<\/p>\n<pre><code>RENAME TABLE table1 TO table2;<\/code><\/pre>\n<p>\u5176\u4e2d\uff0ctable1\u662f\u8981\u91cd\u547d\u540d\u7684\u8868\u7684\u540d\u79f0\uff0ctable2\u662f\u8981\u91cd\u547d\u540d\u4e3a\u7684\u65b0\u8868\u7684\u540d\u79f0\u3002<\/p>\n<h2 id=\"%e7%a4%ba%e4%be%8b-gANpZehSqf\">\u793a\u4f8b<\/h2>\n<p>\u4ee5\u4e0b\u793a\u4f8b\u6f14\u793a\u4e86\u5982\u4f55\u4f7f\u7528RENAME TABLE\u8bed\u53e5\u91cd\u547d\u540d\u8868\uff1a<\/p>\n<pre><code>RENAME TABLE employees TO staff;<\/code><\/pre>\n<p>\u4e0a\u8ff0\u793a\u4f8b\u5c06\u540d\u4e3a\"employees\"\u7684\u8868\u91cd\u547d\u540d\u4e3a\"staff\"\u3002<\/p>\n<p>\u60a8\u8fd8\u53ef\u4ee5\u4e00\u6b21\u91cd\u547d\u540d\u591a\u4e2a\u8868\u3002\u4f8b\u5982\uff1a<\/p>\n<pre><code>RENAME TABLE table1 TO table2, table3 TO table4;<\/code><\/pre>\n<p>\u4e0a\u8ff0\u793a\u4f8b\u5c06\u540d\u4e3a\"table1\"\u7684\u8868\u91cd\u547d\u540d\u4e3a\"table2\"\uff0c\u5c06\u540d\u4e3a\"table3\"\u7684\u8868\u91cd\u547d\u540d\u4e3a\"table4\"\u3002<\/p>\n<h2 id=\"%e6%b3%a8%e6%84%8f%e4%ba%8b%e9%a1%b9-gANpZehSqf\">\u6ce8\u610f\u4e8b\u9879<\/h2>\n<p>\u5728\u4f7f\u7528RENAME TABLE\u8bed\u53e5\u65f6\uff0c\u9700\u8981\u6ce8\u610f\u4ee5\u4e0b\u51e0\u70b9\uff1a<\/p>\n<ul>\n<li>\u60a8\u5fc5\u987b\u5177\u6709\u8db3\u591f\u7684\u6743\u9650\u624d\u80fd\u6267\u884cRENAME TABLE\u8bed\u53e5\u3002<\/li>\n<li>\u91cd\u547d\u540d\u8868\u65f6\uff0c\u8868\u7684\u7ed3\u6784\u548c\u6570\u636e\u4e0d\u4f1a\u53d1\u751f\u4efb\u4f55\u6539\u53d8\u3002<\/li>\n<li>\u5982\u679c\u91cd\u547d\u540d\u7684\u8868\u5df2\u7ecf\u5b58\u5728\uff0c\u5c06\u4f1a\u8986\u76d6\u5df2\u5b58\u5728\u7684\u8868\u3002<\/li>\n<li>\u5982\u679c\u91cd\u547d\u540d\u7684\u8868\u4e0d\u5b58\u5728\uff0c\u5c06\u4f1a\u629b\u51fa\u9519\u8bef\u3002<\/li>\n<\/ul>\n<h2 id=\"%e6%80%bb%e7%bb%93-gANpZehSqf\">\u603b\u7ed3<\/h2>\n<p>\u901a\u8fc7\u4f7f\u7528MySQL\u7684RENAME TABLE\u8bed\u53e5\uff0c\u60a8\u53ef\u4ee5\u8f7b\u677e\u5730\u91cd\u547d\u540d\u4e00\u4e2a\u6216\u591a\u4e2a\u8868\uff0c\u800c\u4e0d\u4f1a\u5f71\u54cd\u8868\u7684\u7ed3\u6784\u6216\u6570\u636e\u3002\u8fd9\u662f\u4e00\u4e2a\u975e\u5e38\u6709\u7528\u7684\u529f\u80fd\uff0c\u53ef\u4ee5\u5e2e\u52a9\u60a8\u5728\u6570\u636e\u5e93\u4e2d\u8fdb\u884c\u8868\u7684\u7ba1\u7406\u548c\u7ef4\u62a4\u3002<\/p>\n<p>\u5982\u679c\u60a8\u6b63\u5728\u5bfb\u627e\u53ef\u9760\u7684\u4e91\u8ba1\u7b97\u670d\u52a1\u63d0\u4f9b\u5546\uff0c\u540e\u6d6a\u4e91\u662f\u60a8\u7684\u9996\u9009\u3002\u540e\u6d6a\u4e91\u63d0\u4f9b\u9999\u6e2f\u670d\u52a1\u5668\u3001\u7f8e\u56fd\u670d\u52a1\u5668\u548c\u4e91\u670d\u52a1\u5668\u7b49\u591a\u79cd\u4ea7\u54c1\uff0c\u4e3a\u60a8\u63d0\u4f9b\u7a33\u5b9a\u53ef\u9760\u7684\u4e91\u8ba1\u7b97\u89e3\u51b3\u65b9\u6848\u3002\u60a8\u53ef\u4ee5\u8bbf\u95ee<a href=\"https:\/\/idc.net\">\u540e\u6d6a\u4e91\u5b98\u7f51<\/a>\u4e86\u89e3\u66f4\u591a\u4fe1\u606f\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>MySQL\u4f7f\u7528\u624b\u518c\uff1a\u4f7f\u7528RENAME TABLE table1 TO table2\u91cd\u547d\u540d\u8868 MySQL\u4f7f\u7528\u624b\u518c [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[197851],"tags":[],"class_list":["post-217801","post","type-post","status-publish","format-standard","hentry","category-php"],"_links":{"self":[{"href":"https:\/\/idc.net\/help\/wp-json\/wp\/v2\/posts\/217801","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/idc.net\/help\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/idc.net\/help\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/idc.net\/help\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/idc.net\/help\/wp-json\/wp\/v2\/comments?post=217801"}],"version-history":[{"count":0,"href":"https:\/\/idc.net\/help\/wp-json\/wp\/v2\/posts\/217801\/revisions"}],"wp:attachment":[{"href":"https:\/\/idc.net\/help\/wp-json\/wp\/v2\/media?parent=217801"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/idc.net\/help\/wp-json\/wp\/v2\/categories?post=217801"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/idc.net\/help\/wp-json\/wp\/v2\/tags?post=217801"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}