{"id":6416,"date":"2024-11-14T10:23:20","date_gmt":"2024-11-14T02:23:20","guid":{"rendered":"https:\/\/fwq.ai\/blog\/6416\/"},"modified":"2024-11-14T10:23:20","modified_gmt":"2024-11-14T02:23:20","slug":"mysql%e6%9f%a5%e7%9c%8b%e6%95%b0%e6%8d%ae%e5%ba%93%e5%91%bd%e4%bb%a4","status":"publish","type":"post","link":"https:\/\/fwq.ai\/blog\/6416\/","title":{"rendered":"mysql\u67e5\u770b\u6570\u636e\u5e93\u547d\u4ee4"},"content":{"rendered":"<blockquote><p>\n  \u53ef\u4ee5\u901a\u8fc7\u4ee5\u4e0b\u6b65\u9aa4\u67e5\u770b mysql \u6570\u636e\u5e93\uff1a\u8fde\u63a5\u5230\u670d\u52a1\u5668\uff1a\u4f7f\u7528\u547d\u4ee4 mysql -u -p \u8fde\u63a5\u3002\u67e5\u770b\u6570\u636e\u5e93\u5217\u8868\uff1a\u4f7f\u7528\u547d\u4ee4 show databases;\u3002\u9009\u62e9\u6570\u636e\u5e93\uff1a\u4f7f\u7528\u547d\u4ee4 use \u9009\u62e9\u7279\u5b9a\u6570\u636e\u5e93\u3002\u67e5\u770b\u8868\u5217\u8868\uff1a\u4f7f\u7528\u547d\u4ee4 show tables;\u3002\u67e5\u770b\u8868\u7ed3\u6784\uff1a\u4f7f\u7528\u547d\u4ee4 describe \u67e5\u770b\u7279\u5b9a\u8868\u7684\u7ed3\u6784\u3002\n<\/p><\/blockquote>\n<p><img decoding=\"async\" src=\"https:\/\/img.php.cn\/upload\/article\/202408\/02\/2024080207343732330.jpg\" class=\"aligncenter\" title=\"mysql\u67e5\u770b\u6570\u636e\u5e93\u547d\u4ee4\u63d2\u56fe\" alt=\"mysql\u67e5\u770b\u6570\u636e\u5e93\u547d\u4ee4\u63d2\u56fe\" \/><\/p>\n<p><strong>\u5982\u4f55\u67e5\u770b MySQL \u6570\u636e\u5e93\uff1f<\/strong><\/p>\n<p>\u4f7f\u7528 MySQL \u67e5\u770b\u6570\u636e\u5e93\u7684\u65b9\u6cd5\u5982\u4e0b\uff1a<\/p>\n<p><strong>1. \u8fde\u63a5\u5230 MySQL \u670d\u52a1\u5668<\/strong><\/p>\n<p>\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\u8fde\u63a5\u5230 MySQL \u670d\u52a1\u5668\uff1a<\/p>\n<pre>mysql -u root -p<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<ul>\n<li>\u5176\u4e2d root \u662f\u7528\u6237\u540d\uff0cpassword \u662f\u5bc6\u7801\u3002<\/li>\n<\/ul>\n<p><strong>2. \u4f7f\u7528 SHOW DATABASES \u547d\u4ee4<\/strong><\/p>\n<p>\u8981\u67e5\u770b\u6240\u6709\u6570\u636e\u5e93\uff0c\u8bf7\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\uff1a<\/p>\n<pre>SHOW DATABASES;<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p>\u6b64\u547d\u4ee4\u5c06\u663e\u793a\u4e00\u4e2a\u5305\u542b\u6240\u6709\u6570\u636e\u5e93\u540d\u79f0\u7684\u5217\u8868\u3002<\/p>\n<p><strong>3. \u4f7f\u7528 USE \u547d\u4ee4\u9009\u62e9\u4e00\u4e2a\u6570\u636e\u5e93<\/strong><\/p>\n<p>\u8981\u67e5\u770b\u7279\u5b9a\u6570\u636e\u5e93\u7684\u8be6\u7ec6\u4fe1\u606f\uff0c\u8bf7\u5148\u4f7f\u7528 USE \u547d\u4ee4\u9009\u62e9\u8be5\u6570\u636e\u5e93\uff1a<\/p>\n<pre>USE database_name;<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<ul>\n<li>\u5176\u4e2d database_name \u662f\u8981\u9009\u62e9\u7684\u6570\u636e\u5e93\u7684\u540d\u79f0\u3002<\/li>\n<\/ul>\n<p><strong>4. \u4f7f\u7528 SHOW TABLES \u547d\u4ee4<\/strong><\/p>\n<p>\u8981\u67e5\u770b\u6240\u9009\u6570\u636e\u5e93\u4e2d\u7684\u6240\u6709\u8868\uff0c\u8bf7\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\uff1a<\/p>\n<pre>SHOW TABLES;<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p>\u6b64\u547d\u4ee4\u5c06\u663e\u793a\u4e00\u4e2a\u5305\u542b\u6240\u6709\u8868\u540d\u79f0\u7684\u5217\u8868\u3002<\/p>\n<p><strong>5. \u4f7f\u7528 DESCRIBE \u547d\u4ee4\u67e5\u770b\u8868\u7ed3\u6784<\/strong><\/p>\n<p>\u8981\u67e5\u770b\u7279\u5b9a\u8868\u7684\u7ed3\u6784\uff0c\u8bf7\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\uff1a<\/p>\n<pre>DESCRIBE table_name;<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<ul>\n<li>\u5176\u4e2d table_name \u662f\u8981\u67e5\u770b\u7ed3\u6784\u7684\u8868\u7684\u540d\u79f0\u3002<\/li>\n<\/ul>\n<p>\u6b64\u547d\u4ee4\u5c06\u663e\u793a\u8868\u7684\u5217\u3001\u6570\u636e\u7c7b\u578b\u3001\u7ea6\u675f\u548c\u5176\u4ed6\u8be6\u7ec6\u4fe1\u606f\u3002<\/p>\n<p>\u4ee5\u4e0a\u5c31\u662f\u67e5\u770b\u6570\u636e\u5e93\u547d\u4ee4\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>\u53ef\u4ee5\u901a\u8fc7\u4ee5\u4e0b\u6b65\u9aa4\u67e5\u770b mysql \u6570\u636e\u5e93\uff1a\u8fde\u63a5\u5230\u670d\u52a1\u5668\uff1a\u4f7f\u7528\u547d\u4ee4 mysql -u -p \u8fde\u63a5\u3002\u67e5\u770b\u6570\u636e\u5e93\u5217\u8868\uff1a\u4f7f\u7528\u547d\u4ee4 show databases;\u3002\u9009\u62e9\u6570\u636e\u5e93\uff1a\u4f7f\u7528\u547d\u4ee4 use \u9009\u62e9\u7279\u5b9a\u6570\u636e\u5e93\u3002\u67e5\u770b\u8868\u5217\u8868\uff1a\u4f7f\u7528\u547d\u4ee4 show tables;\u3002\u67e5\u770b\u8868\u7ed3\u6784\uff1a\u4f7f\u7528\u547d\u4ee4 describe \u67e5\u770b\u7279\u5b9a\u8868\u7684\u7ed3\u6784\u3002 \u5982\u4f55\u67e5\u770b MySQL \u6570\u636e\u5e93\uff1f \u4f7f\u7528 MySQL \u67e5\u770b\u6570\u636e\u5e93\u7684\u65b9\u6cd5\u5982\u4e0b\uff1a 1. \u8fde\u63a5\u5230 MySQL \u670d\u52a1\u5668 \u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\u8fde\u63a5\u5230 MySQL \u670d\u52a1\u5668\uff1a mysql -u root -p \u767b\u5f55\u540e\u590d\u5236 \u5176\u4e2d root \u662f\u7528\u6237\u540d\uff0cpassword \u662f\u5bc6\u7801\u3002 2. \u4f7f\u7528 SHOW DATABASES \u547d\u4ee4 \u8981\u67e5\u770b\u6240\u6709\u6570\u636e\u5e93\uff0c\u8bf7\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\uff1a SHOW DATABASES; \u767b\u5f55\u540e\u590d\u5236 \u6b64\u547d\u4ee4\u5c06\u663e\u793a\u4e00\u4e2a\u5305\u542b\u6240\u6709\u6570\u636e\u5e93\u540d\u79f0\u7684\u5217\u8868\u3002 3. \u4f7f\u7528 USE \u547d\u4ee4\u9009\u62e9\u4e00\u4e2a\u6570\u636e\u5e93 \u8981\u67e5\u770b\u7279\u5b9a\u6570\u636e\u5e93\u7684\u8be6\u7ec6\u4fe1\u606f\uff0c\u8bf7\u5148\u4f7f\u7528 USE \u547d\u4ee4\u9009\u62e9\u8be5\u6570\u636e\u5e93\uff1a USE [&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-6416","post","type-post","status-publish","format-standard","hentry","category-16"],"_links":{"self":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/6416","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=6416"}],"version-history":[{"count":0,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/6416\/revisions"}],"wp:attachment":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/media?parent=6416"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/categories?post=6416"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/tags?post=6416"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}