{"id":5682,"date":"2024-11-14T08:35:49","date_gmt":"2024-11-14T00:35:49","guid":{"rendered":"https:\/\/fwq.ai\/blog\/5682\/"},"modified":"2024-11-14T08:35:49","modified_gmt":"2024-11-14T00:35:49","slug":"sql%e6%80%8e%e4%b9%88%e6%b7%bb%e5%8a%a0%e6%95%b0%e6%8d%ae%e5%ba%93","status":"publish","type":"post","link":"https:\/\/fwq.ai\/blog\/5682\/","title":{"rendered":"sql\u600e\u4e48\u6dfb\u52a0\u6570\u636e\u5e93"},"content":{"rendered":"<blockquote><p>\n  \u5728 sql \u4e2d\u6dfb\u52a0\u6570\u636e\u5e93\uff1a 1. \u8fde\u63a5\u6570\u636e\u5e93\u670d\u52a1\u5668\uff0c\u9a8c\u8bc1\u7528\u6237\u540d\u548c\u5bc6\u7801\uff1b 2. \u521b\u5efa\u6570\u636e\u5e93\uff0c\u4f7f\u7528 create database \u8bed\u53e5\uff1b 3. \u65ad\u5f00\u8fde\u63a5\uff0c\u4f7f\u7528 exit \u547d\u4ee4\uff1b 4. \u9a8c\u8bc1\u6570\u636e\u5e93\u5df2\u521b\u5efa\uff0c\u4f7f\u7528 show databases \u67e5\u770b\u6570\u636e\u5e93\u5217\u8868\u3002\n<\/p><\/blockquote>\n<p><img decoding=\"async\" src=\"https:\/\/img.php.cn\/upload\/article\/202405\/30\/2024053020365324937.jpg\" class=\"aligncenter\" title=\"sql\u600e\u4e48\u6dfb\u52a0\u6570\u636e\u5e93\u63d2\u56fe\" alt=\"sql\u600e\u4e48\u6dfb\u52a0\u6570\u636e\u5e93\u63d2\u56fe\" \/><\/p>\n<p><strong>\u5982\u4f55\u5728 SQL \u4e2d\u6dfb\u52a0\u6570\u636e\u5e93<\/strong><\/p>\n<p>\u60f3\u8981\u5728 SQL \u4e2d\u6dfb\u52a0\u6570\u636e\u5e93\uff0c\u53ef\u4ee5\u6309\u7167\u4ee5\u4e0b\u6b65\u9aa4\u64cd\u4f5c\uff1a<\/p>\n<p><strong>1. \u8fde\u63a5\u5230\u6570\u636e\u5e93\u670d\u52a1\u5668<\/strong><\/p>\n<p>\u4f7f\u7528 SQL \u5ba2\u6237\u7aef\u8fde\u63a5\u5230\u6570\u636e\u5e93\u670d\u52a1\u5668\u3002\u4f8b\u5982\uff0c\u4f7f\u7528\u547d\u4ee4\u884c\u4e2d\u7684\u4ee5\u4e0b\u547d\u4ee4\uff1a<\/p>\n<pre>mysql -u username -p<\/pre>\n<p>  \u767b\u5f55\u540e\u590d\u5236   <\/p>\n<p>\u5176\u4e2d\uff1a<\/p>\n<ul>\n<li>username \u662f\u60a8\u7684\u6570\u636e\u5e93\u7528\u6237\u540d<\/li>\n<li>-p \u63d0\u793a\u60a8\u8f93\u5165\u5bc6\u7801<\/li>\n<\/ul>\n<p><strong>2. \u521b\u5efa\u6570\u636e\u5e93<\/strong><\/p>\n<p>\u6267\u884c CREATE DATABASE \u8bed\u53e5\u521b\u5efa\u6570\u636e\u5e93\u3002\u4f8b\u5982\uff1a<\/p>\n<pre>CREATE DATABASE my_database;<\/pre>\n<p>  \u767b\u5f55\u540e\u590d\u5236   <\/p>\n<p><strong>3. \u65ad\u5f00\u8fde\u63a5<\/strong><\/p>\n<p>\u4f7f\u7528 EXIT \u547d\u4ee4\u65ad\u5f00\u4e0e\u6570\u636e\u5e93\u670d\u52a1\u5668\u7684\u8fde\u63a5\uff1a<\/p>\n<pre>EXIT;<\/pre>\n<p>  \u767b\u5f55\u540e\u590d\u5236   <\/p>\n<p><strong>4. \u9a8c\u8bc1\u6570\u636e\u5e93\u5df2\u521b\u5efa<\/strong><\/p>\n<p>\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\u9a8c\u8bc1\u6570\u636e\u5e93\u662f\u5426\u5df2\u521b\u5efa\uff1a<\/p>\n<pre>SHOW DATABASES;<\/pre>\n<p>  \u767b\u5f55\u540e\u590d\u5236   <\/p>\n<p>\u5982\u679c my_database \u73b0\u5728\u51fa\u73b0\u5728\u663e\u793a\u7684\u6570\u636e\u5e93\u5217\u8868\u4e2d\uff0c\u5219\u8868\u793a\u6570\u636e\u5e93\u5df2\u6210\u529f\u521b\u5efa\u3002<\/p>\n<p>\u4ee5\u4e0a\u5c31\u662fsql\u600e\u4e48\u6dfb\u52a0\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>\u5728 sql \u4e2d\u6dfb\u52a0\u6570\u636e\u5e93\uff1a 1. \u8fde\u63a5\u6570\u636e\u5e93\u670d\u52a1\u5668\uff0c\u9a8c\u8bc1\u7528\u6237\u540d\u548c\u5bc6\u7801\uff1b 2. \u521b\u5efa\u6570\u636e\u5e93\uff0c\u4f7f\u7528 create database \u8bed\u53e5\uff1b 3. \u65ad\u5f00\u8fde\u63a5\uff0c\u4f7f\u7528 exit \u547d\u4ee4\uff1b 4. \u9a8c\u8bc1\u6570\u636e\u5e93\u5df2\u521b\u5efa\uff0c\u4f7f\u7528 show databases \u67e5\u770b\u6570\u636e\u5e93\u5217\u8868\u3002 \u5982\u4f55\u5728 SQL \u4e2d\u6dfb\u52a0\u6570\u636e\u5e93 \u60f3\u8981\u5728 SQL \u4e2d\u6dfb\u52a0\u6570\u636e\u5e93\uff0c\u53ef\u4ee5\u6309\u7167\u4ee5\u4e0b\u6b65\u9aa4\u64cd\u4f5c\uff1a 1. \u8fde\u63a5\u5230\u6570\u636e\u5e93\u670d\u52a1\u5668 \u4f7f\u7528 SQL \u5ba2\u6237\u7aef\u8fde\u63a5\u5230\u6570\u636e\u5e93\u670d\u52a1\u5668\u3002\u4f8b\u5982\uff0c\u4f7f\u7528\u547d\u4ee4\u884c\u4e2d\u7684\u4ee5\u4e0b\u547d\u4ee4\uff1a mysql -u username -p \u767b\u5f55\u540e\u590d\u5236 \u5176\u4e2d\uff1a username \u662f\u60a8\u7684\u6570\u636e\u5e93\u7528\u6237\u540d -p \u63d0\u793a\u60a8\u8f93\u5165\u5bc6\u7801 2. \u521b\u5efa\u6570\u636e\u5e93 \u6267\u884c CREATE DATABASE \u8bed\u53e5\u521b\u5efa\u6570\u636e\u5e93\u3002\u4f8b\u5982\uff1a CREATE DATABASE my_database; \u767b\u5f55\u540e\u590d\u5236 3. \u65ad\u5f00\u8fde\u63a5 \u4f7f\u7528 EXIT \u547d\u4ee4\u65ad\u5f00\u4e0e\u6570\u636e\u5e93\u670d\u52a1\u5668\u7684\u8fde\u63a5\uff1a [&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-5682","post","type-post","status-publish","format-standard","hentry","category-16"],"_links":{"self":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/5682","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=5682"}],"version-history":[{"count":0,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/5682\/revisions"}],"wp:attachment":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/media?parent=5682"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/categories?post=5682"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/tags?post=5682"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}