{"id":6487,"date":"2024-11-14T08:12:25","date_gmt":"2024-11-14T00:12:25","guid":{"rendered":"https:\/\/fwq.ai\/blog\/6487\/"},"modified":"2024-11-14T08:12:25","modified_gmt":"2024-11-14T00:12:25","slug":"%e6%80%8e%e4%b9%88%e5%ae%8c%e5%85%a8%e5%88%a0%e9%99%a4mysql%e6%95%b0%e6%8d%ae%e5%ba%93","status":"publish","type":"post","link":"https:\/\/fwq.ai\/blog\/6487\/","title":{"rendered":"\u600e\u4e48\u5b8c\u5168\u5220\u9664MySQL\u6570\u636e\u5e93"},"content":{"rendered":"<blockquote><p>\n  \u7b54\u6848\uff1a \u662f\uff0c\u53ef\u4ee5\u901a\u8fc7\u5220\u9664\u6570\u636e\u5e93\u53ca\u5176\u6570\u636e\u76ee\u5f55\u5b8c\u5168\u5220\u9664 mysql \u6570\u636e\u5e93\u3002\u6b65\u9aa4\uff1a\u767b\u9646 mysql \u670d\u52a1\u5668\u5220\u9664\u6570\u636e\u5e93\u786e\u8ba4\u5220\u9664\u53ef\u9009\uff1a\u5220\u9664\u6570\u636e\u76ee\u5f55\n<\/p><\/blockquote>\n<p><img decoding=\"async\" src=\"https:\/\/img.php.cn\/upload\/article\/202408\/05\/2024080517304753550.jpg\" class=\"aligncenter\" title=\"\u600e\u4e48\u5b8c\u5168\u5220\u9664MySQL\u6570\u636e\u5e93\u63d2\u56fe\" alt=\"\u600e\u4e48\u5b8c\u5168\u5220\u9664MySQL\u6570\u636e\u5e93\u63d2\u56fe\" \/><\/p>\n<p><strong>\u5982\u4f55\u5b8c\u5168\u5220\u9664 MySQL \u6570\u636e\u5e93<\/strong><\/p>\n<p><strong>1. \u767b\u9646 MySQL<\/strong><\/p>\n<p>\u9996\u5148\uff0c\u4f60\u9700\u8981\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\u767b\u9646 MySQL \u670d\u52a1\u5668\uff1a<\/p>\n<pre>mysql -u username -p<\/pre>\n<p>  \u767b\u5f55\u540e\u590d\u5236   <\/p>\n<p>\u5176\u4e2d username \u4e3a\u4f60\u7684 MySQL \u7528\u6237\u540d\uff0c-p \u8868\u793a\u9700\u8981\u4f60\u8f93\u5165\u5bc6\u7801\u3002<\/p>\n<p><strong>2. \u5220\u9664\u6570\u636e\u5e93<\/strong><\/p>\n<p>\u8981\u5220\u9664\u6570\u636e\u5e93\uff0c\u8bf7\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\uff1a<\/p>\n<pre>DROP DATABASE database_name;<\/pre>\n<p>  \u767b\u5f55\u540e\u590d\u5236   <\/p>\n<p>\u5176\u4e2d database_name \u4e3a\u4f60\u8981\u5220\u9664\u7684\u6570\u636e\u5e93\u540d\u79f0\u3002<\/p>\n<p><strong>3. \u786e\u8ba4\u5220\u9664<\/strong><\/p>\n<p>\u6570\u636e\u5e93\u5220\u9664\u540e\uff0c\u4f60\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\u786e\u8ba4\uff1a<\/p>\n<pre>SHOW DATABASES;<\/pre>\n<p>  \u767b\u5f55\u540e\u590d\u5236   <\/p>\n<p>\u8be5\u547d\u4ee4\u5c06\u5217\u51fa\u6240\u6709\u6570\u636e\u5e93\uff0c\u5982\u679c\u76ee\u6807\u6570\u636e\u5e93\u4e0d\u518d\u5b58\u5728\uff0c\u5219\u8868\u793a\u5220\u9664\u6210\u529f\u3002<\/p>\n<p><strong>4. \u5220\u9664\u6570\u636e\u76ee\u5f55\uff08\u53ef\u9009\uff09<\/strong><\/p>\n<p>\u5982\u679c\u4f60\u60f3\u8981\u5b8c\u5168\u5220\u9664\u6570\u636e\u5e93\u53ca\u5176\u6570\u636e\u6587\u4ef6\uff0c\u4f60\u53ef\u4ee5\u5220\u9664\u6570\u636e\u5e93\u7684\u6570\u636e\u76ee\u5f55\u3002\u6570\u636e\u76ee\u5f55\u901a\u5e38\u4f4d\u4e8e\u4ee5\u4e0b\u8def\u5f84\uff1a<\/p>\n<pre>\/var\/lib\/mysql\/database_name<\/pre>\n<p>  \u767b\u5f55\u540e\u590d\u5236   <\/p>\n<p>\u5176\u4e2d database_name \u4e3a\u6570\u636e\u5e93\u540d\u79f0\u3002<\/p>\n<p><strong>\u6ce8\u610f\uff1a<\/strong><\/p>\n<ul>\n<li>\u5728\u5220\u9664\u6570\u636e\u5e93\u4e4b\u524d\uff0c\u8bf7\u786e\u4fdd\u4f60\u5df2\u5b8c\u6210\u76f8\u5173\u5907\u4efd\uff0c\u56e0\u4e3a\u5220\u9664\u540e\u65e0\u6cd5\u6062\u590d\u6570\u636e\u3002<\/li>\n<li>\u5982\u679c\u76ee\u6807\u6570\u636e\u5e93\u62e5\u6709\u8868\uff0c\u4f60\u9700\u8981\u5728\u5220\u9664\u6570\u636e\u5e93\u4e4b\u524d\u5220\u9664\u6240\u6709\u8868\u3002<\/li>\n<li>\u5982\u679c\u76ee\u6807\u6570\u636e\u5e93\u5305\u542b\u4f9d\u8d56\u5173\u7cfb\u6216\u5916\u952e\u7ea6\u675f\uff0c\u4f60\u9700\u8981\u5728\u5220\u9664\u6570\u636e\u5e93\u4e4b\u524d\u5148\u5220\u9664\u5b83\u4eec\u3002<\/li>\n<\/ul>\n<p>\u4ee5\u4e0a\u5c31\u662f\u600e\u4e48\u5b8c\u5168\u5220\u9664MySQL\u6570\u636e\u5e93\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>\u7b54\u6848\uff1a \u662f\uff0c\u53ef\u4ee5\u901a\u8fc7\u5220\u9664\u6570\u636e\u5e93\u53ca\u5176\u6570\u636e\u76ee\u5f55\u5b8c\u5168\u5220\u9664 mysql \u6570\u636e\u5e93\u3002\u6b65\u9aa4\uff1a\u767b\u9646 mysql \u670d\u52a1\u5668\u5220\u9664\u6570\u636e\u5e93\u786e\u8ba4\u5220\u9664\u53ef\u9009\uff1a\u5220\u9664\u6570\u636e\u76ee\u5f55 \u5982\u4f55\u5b8c\u5168\u5220\u9664 MySQL \u6570\u636e\u5e93 1. \u767b\u9646 MySQL \u9996\u5148\uff0c\u4f60\u9700\u8981\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\u767b\u9646 MySQL \u670d\u52a1\u5668\uff1a mysql -u username -p \u767b\u5f55\u540e\u590d\u5236 \u5176\u4e2d username \u4e3a\u4f60\u7684 MySQL \u7528\u6237\u540d\uff0c-p \u8868\u793a\u9700\u8981\u4f60\u8f93\u5165\u5bc6\u7801\u3002 2. \u5220\u9664\u6570\u636e\u5e93 \u8981\u5220\u9664\u6570\u636e\u5e93\uff0c\u8bf7\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\uff1a DROP DATABASE database_name; \u767b\u5f55\u540e\u590d\u5236 \u5176\u4e2d database_name \u4e3a\u4f60\u8981\u5220\u9664\u7684\u6570\u636e\u5e93\u540d\u79f0\u3002 3. \u786e\u8ba4\u5220\u9664 \u6570\u636e\u5e93\u5220\u9664\u540e\uff0c\u4f60\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\u786e\u8ba4\uff1a SHOW DATABASES; \u767b\u5f55\u540e\u590d\u5236 \u8be5\u547d\u4ee4\u5c06\u5217\u51fa\u6240\u6709\u6570\u636e\u5e93\uff0c\u5982\u679c\u76ee\u6807\u6570\u636e\u5e93\u4e0d\u518d\u5b58\u5728\uff0c\u5219\u8868\u793a\u5220\u9664\u6210\u529f\u3002 4. \u5220\u9664\u6570\u636e\u76ee\u5f55\uff08\u53ef\u9009\uff09 \u5982\u679c\u4f60\u60f3\u8981\u5b8c\u5168\u5220\u9664\u6570\u636e\u5e93\u53ca\u5176\u6570\u636e\u6587\u4ef6\uff0c\u4f60\u53ef\u4ee5\u5220\u9664\u6570\u636e\u5e93\u7684\u6570\u636e\u76ee\u5f55\u3002\u6570\u636e\u76ee\u5f55\u901a\u5e38\u4f4d\u4e8e\u4ee5\u4e0b\u8def\u5f84\uff1a \/var\/lib\/mysql\/database_name \u767b\u5f55\u540e\u590d\u5236 \u5176\u4e2d database_name \u4e3a\u6570\u636e\u5e93\u540d\u79f0\u3002 \u6ce8\u610f\uff1a \u5728\u5220\u9664\u6570\u636e\u5e93\u4e4b\u524d\uff0c\u8bf7\u786e\u4fdd\u4f60\u5df2\u5b8c\u6210\u76f8\u5173\u5907\u4efd\uff0c\u56e0\u4e3a\u5220\u9664\u540e\u65e0\u6cd5\u6062\u590d\u6570\u636e\u3002 \u5982\u679c\u76ee\u6807\u6570\u636e\u5e93\u62e5\u6709\u8868\uff0c\u4f60\u9700\u8981\u5728\u5220\u9664\u6570\u636e\u5e93\u4e4b\u524d\u5220\u9664\u6240\u6709\u8868\u3002 \u5982\u679c\u76ee\u6807\u6570\u636e\u5e93\u5305\u542b\u4f9d\u8d56\u5173\u7cfb\u6216\u5916\u952e\u7ea6\u675f\uff0c\u4f60\u9700\u8981\u5728\u5220\u9664\u6570\u636e\u5e93\u4e4b\u524d\u5148\u5220\u9664\u5b83\u4eec\u3002 [&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-6487","post","type-post","status-publish","format-standard","hentry","category-16"],"_links":{"self":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/6487","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=6487"}],"version-history":[{"count":0,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/6487\/revisions"}],"wp:attachment":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/media?parent=6487"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/categories?post=6487"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/tags?post=6487"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}