{"id":5502,"date":"2024-11-14T10:44:10","date_gmt":"2024-11-14T02:44:10","guid":{"rendered":"https:\/\/fwq.ai\/blog\/5502\/"},"modified":"2024-11-14T10:44:10","modified_gmt":"2024-11-14T02:44:10","slug":"mysql%e6%80%8e%e4%b9%88%e6%98%be%e7%a4%ba%e6%89%80%e6%9c%89%e7%9a%84%e6%95%b0%e6%8d%ae%e5%ba%93","status":"publish","type":"post","link":"https:\/\/fwq.ai\/blog\/5502\/","title":{"rendered":"mysql\u600e\u4e48\u663e\u793a\u6240\u6709\u7684\u6570\u636e\u5e93"},"content":{"rendered":"<blockquote><p>\n  \u8981\u67e5\u770b\u6240\u6709 mysql \u6570\u636e\u5e93\uff0c\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b\u65b9\u6cd5\uff1a\u8fd0\u884c show databases \u547d\u4ee4\uff1b\u67e5\u8be2 information_schema.schemata \u8868\u4e2d\u7684 schema_name \u5217\uff1b\u8bbf\u95ee sys.databases \u8868\uff08mysql 8.0 \u53ca\u66f4\u9ad8\u7248\u672c\u53ef\u7528\uff09\u3002\n<\/p><\/blockquote>\n<p><img decoding=\"async\" src=\"https:\/\/img.php.cn\/upload\/article\/202405\/29\/2024052905073412737.jpg\" class=\"aligncenter\" title=\"mysql\u600e\u4e48\u663e\u793a\u6240\u6709\u7684\u6570\u636e\u5e93\u63d2\u56fe\" alt=\"mysql\u600e\u4e48\u663e\u793a\u6240\u6709\u7684\u6570\u636e\u5e93\u63d2\u56fe\" \/><\/p>\n<p><strong>\u5982\u4f55\u663e\u793a\u6240\u6709 MySQL \u6570\u636e\u5e93<\/strong><\/p>\n<p>\u5728 MySQL \u4e2d\uff0c\u53ef\u4ee5\u901a\u8fc7\u4ee5\u4e0b\u65b9\u6cd5\u663e\u793a\u6240\u6709\u6570\u636e\u5e93\uff1a<\/p>\n<p><strong>\u4f7f\u7528 SHOW DATABASES \u547d\u4ee4<\/strong><\/p>\n<pre>SHOW DATABASES;<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p><strong>\u4f7f\u7528 INFORMATION_SCHEMA.SCHEMATA \u8868<\/strong><\/p>\n<pre>SELECT SCHEMA_NAME\nFROM INFORMATION_SCHEMA.SCHEMATA;<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p><strong>\u4f7f\u7528 sys.databases \u8868\uff08\u4ec5\u9002\u7528\u4e8e MySQL 8.0 \u53ca\u66f4\u9ad8\u7248\u672c\uff09<\/strong><\/p>\n<pre>SELECT name\nFROM sys.databases;<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p><strong>\u7ed3\u679c<\/strong><\/p>\n<p>\u4e0a\u8ff0\u547d\u4ee4\u5c06\u8fd4\u56de\u4e00\u4e2a\u5305\u542b\u6240\u6709 MySQL \u6570\u636e\u5e93\u540d\u79f0\u7684\u5217\u8868\u3002\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u540d\u304c\u5404\u884c\u4e2d\u5217\u51fa\u3002<\/p>\n<p>\u4ee5\u4e0a\u5c31\u662f\u600e\u4e48\u663e\u793a\u6240\u6709\u7684\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\u67e5\u770b\u6240\u6709 mysql \u6570\u636e\u5e93\uff0c\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b\u65b9\u6cd5\uff1a\u8fd0\u884c show databases \u547d\u4ee4\uff1b\u67e5\u8be2 information_schema.schemata \u8868\u4e2d\u7684 schema_name \u5217\uff1b\u8bbf\u95ee sys.databases \u8868\uff08mysql 8.0 \u53ca\u66f4\u9ad8\u7248\u672c\u53ef\u7528\uff09\u3002 \u5982\u4f55\u663e\u793a\u6240\u6709 MySQL \u6570\u636e\u5e93 \u5728 MySQL \u4e2d\uff0c\u53ef\u4ee5\u901a\u8fc7\u4ee5\u4e0b\u65b9\u6cd5\u663e\u793a\u6240\u6709\u6570\u636e\u5e93\uff1a \u4f7f\u7528 SHOW DATABASES \u547d\u4ee4 SHOW DATABASES; \u767b\u5f55\u540e\u590d\u5236 \u4f7f\u7528 INFORMATION_SCHEMA.SCHEMATA \u8868 SELECT SCHEMA_NAME FROM INFORMATION_SCHEMA.SCHEMATA; \u767b\u5f55\u540e\u590d\u5236 \u4f7f\u7528 sys.databases \u8868\uff08\u4ec5\u9002\u7528\u4e8e MySQL 8.0 \u53ca\u66f4\u9ad8\u7248\u672c\uff09 SELECT name FROM sys.databases; \u767b\u5f55\u540e\u590d\u5236 \u7ed3\u679c \u4e0a\u8ff0\u547d\u4ee4\u5c06\u8fd4\u56de\u4e00\u4e2a\u5305\u542b\u6240\u6709 MySQL \u6570\u636e\u5e93\u540d\u79f0\u7684\u5217\u8868\u3002\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u540d\u304c\u5404\u884c\u4e2d\u5217\u51fa\u3002 \u4ee5\u4e0a\u5c31\u662f\u600e\u4e48\u663e\u793a\u6240\u6709\u7684\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},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[16],"tags":[],"class_list":["post-5502","post","type-post","status-publish","format-standard","hentry","category-16"],"_links":{"self":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/5502","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=5502"}],"version-history":[{"count":0,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/5502\/revisions"}],"wp:attachment":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/media?parent=5502"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/categories?post=5502"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/tags?post=5502"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}