{"id":6473,"date":"2024-11-14T10:03:13","date_gmt":"2024-11-14T02:03:13","guid":{"rendered":"https:\/\/fwq.ai\/blog\/6473\/"},"modified":"2024-11-14T10:03:13","modified_gmt":"2024-11-14T02:03:13","slug":"mysql%e6%80%8e%e4%b9%88%e8%bf%9e%e6%8e%a5%e6%9c%ac%e5%9c%b0%e6%95%b0%e6%8d%ae%e5%ba%93","status":"publish","type":"post","link":"https:\/\/fwq.ai\/blog\/6473\/","title":{"rendered":"mysql\u600e\u4e48\u8fde\u63a5\u672c\u5730\u6570\u636e\u5e93"},"content":{"rendered":"<blockquote><p>\n  \u8981\u8fde\u63a5\u5230\u672c\u5730 mysql \u6570\u636e\u5e93\uff0c\u8bf7\uff1a\u4f7f\u7528\u547d\u4ee4\u884c\u5de5\u5177\u5bfc\u822a\u5230 mysql \u5b89\u88c5\u76ee\u5f55\u5e76\u8fd0\u884c mysql -u root -p\u3002\u8f93\u5165 mysql root \u7528\u6237\u5bc6\u7801\u3002\u8fde\u63a5\u6210\u529f\u540e\uff0c\u4f7f\u7528 use database_name; \u8fde\u63a5\u5230\u7279\u5b9a\u6570\u636e\u5e93\u3002\n<\/p><\/blockquote>\n<p><img decoding=\"async\" src=\"https:\/\/img.php.cn\/upload\/article\/202408\/05\/2024080508132320555.jpg\" class=\"aligncenter\" title=\"mysql\u600e\u4e48\u8fde\u63a5\u672c\u5730\u6570\u636e\u5e93\u63d2\u56fe\" alt=\"mysql\u600e\u4e48\u8fde\u63a5\u672c\u5730\u6570\u636e\u5e93\u63d2\u56fe\" \/><\/p>\n<p><strong>\u5982\u4f55\u8fde\u63a5\u5230\u672c\u5730 MySQL \u6570\u636e\u5e93<\/strong><\/p>\n<p>MySQL \u662f\u4e00\u4e2a\u6d41\u884c\u7684\u5173\u7cfb\u578b\u6570\u636e\u5e93\u7ba1\u7406\u7cfb\u7edf (RDBMS)\uff0c\u5b83\u5141\u8bb8\u7528\u6237\u5b58\u50a8\u3001\u7ba1\u7406\u548c\u68c0\u7d22\u6570\u636e\u3002\u8981\u8fde\u63a5\u5230\u672c\u5730 MySQL \u6570\u636e\u5e93\uff0c\u9700\u8981\u9075\u5faa\u4ee5\u4e0b\u6b65\u9aa4\uff1a<\/p>\n<p><strong>1. \u4f7f\u7528\u547d\u4ee4\u884c<\/strong><\/p>\n<ul>\n<li>\u6253\u5f00\u547d\u4ee4\u63d0\u793a\u7b26\u6216\u7ec8\u7aef\u7a97\u53e3\u3002<\/li>\n<li>\u5bfc\u822a\u5230 MySQL \u5b89\u88c5\u76ee\u5f55\uff08\u901a\u5e38\u4e3a \/usr\/local\/\/bin\uff09\u3002<\/li>\n<li>\u8fd0\u884c\u4ee5\u4e0b\u547d\u4ee4\uff1a<\/li>\n<\/ul>\n<pre>mysql -u root -p<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<ul>\n<li>&#8220;root&#8221; \u662f\u9ed8\u8ba4\u7684 MySQL \u7528\u6237\u540d\u3002<\/li>\n<li>&#8220;-p&#8221; \u6807\u5fd7\u63d0\u793a\u60a8\u8f93\u5165\u5bc6\u7801\u3002<\/li>\n<\/ul>\n<p><strong>2. \u8f93\u5165\u5bc6\u7801<\/strong><\/p>\n<p>\u8f93\u5165 MySQL root \u7528\u6237\u7684\u5bc6\u7801\u3002\u5982\u679c\u60a8\u5c1a\u672a\u8bbe\u7f6e\u5bc6\u7801\uff0c\u8bf7\u6309 Enter \u952e\u3002<\/p>\n<p><strong>3. \u8fde\u63a5\u6210\u529f<\/strong><\/p>\n<p>\u5982\u679c\u8fde\u63a5\u6210\u529f\uff0c\u60a8\u5c06\u770b\u5230\u7c7b\u4f3c\u4ee5\u4e0b\u5185\u5bb9\u7684\u63d0\u793a\uff1a<\/p>\n<pre>Welcome to the MySQL monitor.  Commands end with ; or g.\nYour MySQL connection id is 17\nServer version: 8.0.27-0ubuntu0.20.04.1 (Ubuntu)\n\nCopyright (c) 2000, 2021, Oracle and\/or its affiliates.\n\nOracle MySQL Community Server - GPL.<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p><strong>4. \u8fde\u63a5\u5230\u7279\u5b9a\u6570\u636e\u5e93<\/strong><\/p>\n<p>\u8981\u8fde\u63a5\u5230\u7279\u5b9a\u6570\u636e\u5e93\uff0c\u8bf7\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\uff1a<\/p>\n<pre>USE database_name;<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p>\u5176\u4e2d &#8220;database_name&#8221; \u662f\u60a8\u8981\u8fde\u63a5\u7684\u6570\u636e\u5e93\u7684\u540d\u79f0\u3002<\/p>\n<p><strong>\u4f7f\u7528 MySQL Workbench \u7b49 GUI \u5de5\u5177<\/strong><\/p>\n<p>\u5982\u679c\u60a8\u66f4\u559c\u6b22\u4f7f\u7528 GUI \u5de5\u5177\uff0c\u53ef\u4ee5\u4f7f\u7528 MySQL Workbench \u7b49\u5de5\u5177\u8fde\u63a5\u5230\u672c\u5730 MySQL \u6570\u636e\u5e93\u3002<\/p>\n<ul>\n<li>\u6253\u5f00 MySQL Workbench\u3002<br \/>*\u5355\u51fb &#8220;Database&#8221; \u83dc\u5355\uff0c\u7136\u540e\u9009\u62e9 &#8220;Connect to Database&#8221;\u3002<\/li>\n<li>\u5728 &#8220;Connection&#8221; \u9009\u9879\u5361\u4e2d\uff0c\u8f93\u5165\u4ee5\u4e0b\u4fe1\u606f\uff1a<\/li>\n<li> <strong>Hostname:<\/strong> localhost<\/li>\n<li> <strong>Username:<\/strong> root<\/li>\n<li> <strong>Password:<\/strong> [MySQL root \u7528\u6237\u7684\u5bc6\u7801]<\/li>\n<li> <strong>Port Number:<\/strong> 3306 (\u9ed8\u8ba4 MySQL \u7aef\u53e3)<\/li>\n<li> <strong>Database:<\/strong> \u8981\u8fde\u63a5\u7684\u6570\u636e\u5e93\u7684\u540d\u79f0<\/li>\n<li>\u5355\u51fb &#8220;Connect&#8221; \u6309\u94ae\u4ee5\u5efa\u7acb\u8fde\u63a5\u3002<\/li>\n<\/ul>\n<p>\u8fde\u63a5\u6210\u529f\u540e\uff0c\u60a8\u5c06\u5728 MySQL Workbench \u4e2d\u770b\u5230\u6570\u636e\u5e93\u6a21\u5f0f\u548c\u6570\u636e\u3002<\/p>\n<p>\u4ee5\u4e0a\u5c31\u662f\u600e\u4e48\u8fde\u63a5\u672c\u5730\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>\u8981\u8fde\u63a5\u5230\u672c\u5730 mysql \u6570\u636e\u5e93\uff0c\u8bf7\uff1a\u4f7f\u7528\u547d\u4ee4\u884c\u5de5\u5177\u5bfc\u822a\u5230 mysql \u5b89\u88c5\u76ee\u5f55\u5e76\u8fd0\u884c mysql -u root -p\u3002\u8f93\u5165 mysql root \u7528\u6237\u5bc6\u7801\u3002\u8fde\u63a5\u6210\u529f\u540e\uff0c\u4f7f\u7528 use database_name; \u8fde\u63a5\u5230\u7279\u5b9a\u6570\u636e\u5e93\u3002 \u5982\u4f55\u8fde\u63a5\u5230\u672c\u5730 MySQL \u6570\u636e\u5e93 MySQL \u662f\u4e00\u4e2a\u6d41\u884c\u7684\u5173\u7cfb\u578b\u6570\u636e\u5e93\u7ba1\u7406\u7cfb\u7edf (RDBMS)\uff0c\u5b83\u5141\u8bb8\u7528\u6237\u5b58\u50a8\u3001\u7ba1\u7406\u548c\u68c0\u7d22\u6570\u636e\u3002\u8981\u8fde\u63a5\u5230\u672c\u5730 MySQL \u6570\u636e\u5e93\uff0c\u9700\u8981\u9075\u5faa\u4ee5\u4e0b\u6b65\u9aa4\uff1a 1. \u4f7f\u7528\u547d\u4ee4\u884c \u6253\u5f00\u547d\u4ee4\u63d0\u793a\u7b26\u6216\u7ec8\u7aef\u7a97\u53e3\u3002 \u5bfc\u822a\u5230 MySQL \u5b89\u88c5\u76ee\u5f55\uff08\u901a\u5e38\u4e3a \/usr\/local\/\/bin\uff09\u3002 \u8fd0\u884c\u4ee5\u4e0b\u547d\u4ee4\uff1a mysql -u root -p \u767b\u5f55\u540e\u590d\u5236 &#8220;root&#8221; \u662f\u9ed8\u8ba4\u7684 MySQL \u7528\u6237\u540d\u3002 &#8220;-p&#8221; \u6807\u5fd7\u63d0\u793a\u60a8\u8f93\u5165\u5bc6\u7801\u3002 2. \u8f93\u5165\u5bc6\u7801 \u8f93\u5165 MySQL root \u7528\u6237\u7684\u5bc6\u7801\u3002\u5982\u679c\u60a8\u5c1a\u672a\u8bbe\u7f6e\u5bc6\u7801\uff0c\u8bf7\u6309 Enter \u952e\u3002 3. \u8fde\u63a5\u6210\u529f \u5982\u679c\u8fde\u63a5\u6210\u529f\uff0c\u60a8\u5c06\u770b\u5230\u7c7b\u4f3c\u4ee5\u4e0b\u5185\u5bb9\u7684\u63d0\u793a\uff1a Welcome to [&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-6473","post","type-post","status-publish","format-standard","hentry","category-16"],"_links":{"self":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/6473","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=6473"}],"version-history":[{"count":0,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/6473\/revisions"}],"wp:attachment":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/media?parent=6473"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/categories?post=6473"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/tags?post=6473"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}