{"id":135172,"date":"2024-04-28T12:09:13","date_gmt":"2024-04-28T04:09:13","guid":{"rendered":"https:\/\/docs.pingcode.com\/ask\/ask-ask\/135172.html"},"modified":"2024-04-28T12:09:16","modified_gmt":"2024-04-28T04:09:16","slug":"mariadb%e6%80%8e%e4%b9%88%e6%9f%a5%e7%9c%8b%e6%95%b0%e6%8d%ae%e5%ba%93","status":"publish","type":"post","link":"https:\/\/docs.pingcode.com\/ask\/135172.html","title":{"rendered":"mariadb\u600e\u4e48\u67e5\u770b\u6570\u636e\u5e93"},"content":{"rendered":"<p style=\"text-align:center\"><img decoding=\"async\" src=\"https:\/\/cdn-kb.worktile.com\/kb\/wp-content\/uploads\/2024\/04\/24132544\/c7333181-32cc-4227-be17-c548e6c2ac0c.webp\" alt=\"mariadb\u600e\u4e48\u67e5\u770b\u6570\u636e\u5e93\" \/><\/p>\n<p><p>\u67e5\u770bMariaDB\u4e2d\u7684\u6570\u636e\u5e93\u4e3b\u8981\u901a\u8fc7SQL\u8bed\u53e5<code>SHOW DATABASES<\/code>\u5b8c\u6210\uff0c\u8be5\u547d\u4ee4\u5c06\u5217\u51fa\u6570\u636e\u5e93\u670d\u52a1\u5668\u4e0a\u6240\u6709\u7684\u6570\u636e\u5e93\u3002<strong>\u6570\u636e\u5e93\u7ba1\u7406\u5458\u53ef\u4ee5\u901a\u8fc7\u4f7f\u7528\u8be5\u547d\u4ee4\u3001\u67e5\u770b\u5177\u4f53\u6570\u636e\u5e93\u7684\u7ed3\u6784\u4ee5\u53ca\u8bbf\u95ee\u7279\u5b9a\u6570\u636e\u5e93<\/strong>\u3002\u5728\u8fdb\u884c\u6570\u636e\u5e93\u67e5\u770b\u64cd\u4f5c\u65f6\uff0c\u786e\u4fdd\u60a8\u62e5\u6709\u8db3\u591f\u7684\u6743\u9650\uff0c\u4f7f\u7528\u6b63\u786e\u7684\u8bed\u6cd5\u548c\u7b26\u5408\u5b89\u5168\u6807\u51c6\u7684\u64cd\u4f5c\u3002<\/p>\n<\/p>\n<p><p>\u63a5\u4e0b\u6765\uff0c\u6211\u4eec\u5c06\u8be6\u7ec6\u63a2\u8ba8\u5982\u4f55\u4f7f\u7528<code>SHOW DATABASES<\/code>\u8bed\u53e5\u67e5\u770b\u6570\u636e\u5e93\uff0c\u4ee5\u53ca\u5982\u4f55\u5bf9\u7279\u5b9a\u6570\u636e\u5e93\u6267\u884c\u66f4\u8be6\u7ec6\u7684\u67e5\u8be2\u3002<\/p>\n<\/p>\n<p><p>\u4e00\u3001\u67e5\u770b\u6240\u6709\u6570\u636e\u5e93<\/p>\n<\/p>\n<p><p>\u9996\u5148\uff0c\u8981\u67e5\u770bMariaDB\u670d\u52a1\u5668\u4e0a\u7684\u6240\u6709\u6570\u636e\u5e93\uff0c\u60a8\u53ef\u4ee5\u6267\u884c\u4ee5\u4e0bSQL\u547d\u4ee4\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-sql\">SHOW DATABASES;<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u5f53\u60a8\u901a\u8fc7\u6570\u636e\u5e93\u7ba1\u7406\u5de5\u5177\uff08\u6bd4\u5982phpMyAdmin\uff09\u6216\u547d\u4ee4\u884c\uff08\u4f7f\u7528mariadb\u6216mysql\u5ba2\u6237\u7aef\uff09\u53d1\u9001\u8fd9\u6761\u547d\u4ee4\u65f6\uff0c\u7cfb\u7edf\u5c06\u8fd4\u56de\u5f53\u524d\u6240\u6709\u6570\u636e\u5e93\u7684\u5217\u8868\u3002\u6bcf\u4e2a\u8fd4\u56de\u7684\u6570\u636e\u5e93\u540d\u79f0\u4ee3\u8868\u670d\u52a1\u5668\u4e0a\u4e00\u4e2a\u72ec\u7acb\u7684\u6570\u636e\u5e93\uff0c\u8fd9\u4e9b\u6570\u636e\u5e93\u53ef\u80fd\u5305\u542b\u591a\u4e2a\u6570\u636e\u8868\u548c\u6570\u636e\u3002<\/p>\n<\/p>\n<p><p>\u4e8c\u3001\u9009\u62e9\u7279\u5b9a\u6570\u636e\u5e93<\/p>\n<\/p>\n<p><p>\u5728\u786e\u8ba4MariaDB\u4e2d\u6709\u54ea\u4e9b\u6570\u636e\u5e93\u4e4b\u540e\uff0c\u60a8\u53ef\u80fd\u9700\u8981\u67e5\u770b\u67d0\u4e2a\u7279\u5b9a\u6570\u636e\u5e93\u7684\u7ed3\u6784\u6216\u5185\u5bb9\u3002\u6b64\u65f6\uff0c\u60a8\u9700\u8981\u9996\u5148\u201c\u9009\u62e9\u201d\u8be5\u6570\u636e\u5e93\uff0c\u518d\u8fdb\u884c\u8fdb\u4e00\u6b65\u7684\u64cd\u4f5c\u3002\u60a8\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\u9009\u62e9\u6570\u636e\u5e93\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-sql\">USE database_name;<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u66ff\u6362<code>database_name<\/code>\u4e3a\u60a8\u60f3\u8981\u67e5\u770b\u7684\u6570\u636e\u5e93\u3002\u8fd9\u4e00\u6b65\u4e0d\u4f1a\u76f4\u63a5\u663e\u793a\u4efb\u4f55\u4fe1\u606f\uff0c\u4f46\u5b83\u4f1a\u8bbe\u7f6e\u540e\u7eed\u547d\u4ee4\u7684\u4e0a\u4e0b\u6587\u4e3a\u60a8\u9009\u62e9\u7684\u6570\u636e\u5e93\u3002<\/p>\n<\/p>\n<p><p>\u4e09\u3001\u67e5\u770b\u6570\u636e\u5e93\u8868<\/p>\n<\/p>\n<p><p>\u9009\u62e9\u6570\u636e\u5e93\u540e\uff0c\u8981\u67e5\u770b\u6240\u9009\u6570\u636e\u5e93\u4e2d\u5305\u542b\u7684\u6570\u636e\u8868\uff0c\u53ef\u4ee5\u4f7f\u7528<code>SHOW TABLES<\/code>\u547d\u4ee4\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-sql\">SHOW TABLES;<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u8fd9\u5c06\u5217\u51fa\u5f53\u524d\u5df2\u9009\u6570\u636e\u5e93\u4e2d\u6240\u6709\u8868\u7684\u540d\u79f0\u3002<\/p>\n<\/p>\n<p><p>\u56db\u3001\u83b7\u53d6\u8868\u7ed3\u6784<\/p>\n<\/p>\n<p><p>\u4e86\u89e3\u6570\u636e\u5e93\u4e2d\u6709\u54ea\u4e9b\u8868\u540e\uff0c\u60a8\u53ef\u80fd\u8fd8\u4f1a\u60f3\u8981\u83b7\u53d6\u67d0\u4e2a\u7279\u5b9a\u8868\u7684\u7ed3\u6784\u4fe1\u606f\u3002<code>DESCRIBE<\/code>\u547d\u4ee4\u7528\u4e8e\u67e5\u770b\u6570\u636e\u8868\u7684\u6240\u6709\u5217\u53ca\u5176\u76f8\u5173\u4fe1\u606f\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-sql\">DESCRIBE table_name;<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u5c06<code>table_name<\/code>\u66ff\u6362\u4e3a\u60a8\u611f\u5174\u8da3\u7684\u5177\u4f53\u6570\u636e\u8868\u540d\u3002<\/p>\n<\/p>\n<p><p>\u4e94\u3001\u67e5\u8be2\u8868\u6570\u636e<\/p>\n<\/p>\n<p><p>\u9664\u4e86\u67e5\u770b\u6570\u636e\u5e93\u548c\u8868\u7684\u7ed3\u6784\uff0c\u901a\u5e38\u8fd8\u9700\u8981\u67e5\u770b\u8868\u4e2d\u7684\u6570\u636e\u3002\u8fd9\u53ef\u4ee5\u901a\u8fc7<code>SELECT<\/code>\u8bed\u53e5\u5b8c\u6210\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-sql\">SELECT * FROM table_name;<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u6b64\u547d\u4ee4\u4f1a\u5217\u51fa<code>table_name<\/code>\u6570\u636e\u8868\u4e2d\u7684\u6240\u6709\u6570\u636e\u3002\u60a8\u53ef\u4ee5\u6dfb\u52a0\u6761\u4ef6\u5b50\u53e5\u4ee5\u7f29\u5c0f\u67e5\u8be2\u8303\u56f4\u3002<\/p>\n<\/p>\n<p><p>\u516d\u3001\u67e5\u770b\u6570\u636e\u5e93\u72b6\u6001<\/p>\n<\/p>\n<p><p>\u6709\u65f6\u5019\uff0c\u4ec5\u4ec5\u77e5\u9053\u6570\u636e\u5e93\u5217\u8868\u8fd8\u4e0d\u591f\uff0c\u60a8\u53ef\u80fd\u8fd8\u9700\u8981\u4e86\u89e3\u6570\u636e\u5e93\u670d\u52a1\u5668\u7684\u72b6\u6001\u3002\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\u53ef\u4ee5\u83b7\u53d6\u6570\u636e\u5e93\u670d\u52a1\u5668\u7684\u72b6\u6001\u4fe1\u606f\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-sql\">SHOW STATUS;<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u8fd9\u5c06\u663e\u793a\u4e00\u7cfb\u5217\u7cfb\u7edf\u53d8\u91cf\u548c\u503c\uff0c\u4e3a\u60a8\u63d0\u4f9b\u6570\u636e\u5e93\u670d\u52a1\u5668\u8fd0\u884c\u65f6\u7684\u5173\u952e\u4fe1\u606f\u3002<\/p>\n<\/p>\n<p><p>\u4e03\u3001\u68c0\u67e5\u7528\u6237\u6743\u9650<\/p>\n<\/p>\n<p><p>\u4e3a\u4e86\u67e5\u770b\u6570\u636e\u5e93\uff0c\u7528\u6237\u9700\u8981\u5177\u5907\u76f8\u5e94\u7684\u6743\u9650\u3002\u60a8\u53ef\u4ee5\u7528\u4e0b\u9762\u7684\u547d\u4ee4\u6765\u68c0\u67e5\u5f53\u524d\u7528\u6237\u7684\u6743\u9650\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-sql\">SHOW GRANTS;<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u8fd9\u4e2a\u547d\u4ee4\u5217\u51fa\u4e86\u5f53\u524d\u7528\u6237\u5728\u6570\u636e\u5e93\u670d\u52a1\u5668\u4e0a\u7684\u6743\u9650\uff0c\u786e\u4fdd\u60a8\u6709\u8db3\u591f\u7684\u6743\u9650\u6765\u67e5\u770b\u6570\u636e\u5e93\u4fe1\u606f\u3002<\/p>\n<\/p>\n<p><p>\u516b\u3001\u9ad8\u7ea7\u67e5\u8be2<\/p>\n<\/p>\n<p><p>\u5728\u67d0\u4e9b\u60c5\u51b5\u4e0b\uff0c\u60a8\u53ef\u80fd\u4e0d\u4ec5\u4ec5\u9700\u8981\u67e5\u770b\u6570\u636e\u5e93\u5217\u8868\uff0c\u8fd8\u8981\u6267\u884c\u66f4\u590d\u6742\u7684\u67e5\u8be2\uff0c\u6bd4\u5982\u67e5\u627e\u7279\u5b9a\u540d\u5b57\u7684\u6570\u636e\u5e93\u3001\u8fc7\u6ee4\u7279\u5b9a\u6761\u4ef6\u7684\u6570\u636e\u5e93\u7b49\u3002\u8fd9\u65f6\uff0c\u53ef\u4ee5\u7ed3\u5408\u4f7f\u7528<code>SHOW DATABASES<\/code>\u4e0e<code>LIKE<\/code>\u5b50\u53e5\u6216\u5176\u4ed6SQL\u7b5b\u9009\u6280\u672f\u3002<\/p>\n<\/p>\n<p><p>\u6839\u636e\u4ee5\u4e0a\u6b65\u9aa4\uff0c\u60a8\u80fd\u591f\u6709\u6548\u5730\u68c0\u67e5\u548c\u7ba1\u7406MariaDB\u4e2d\u7684\u6570\u636e\u5e93\u3002<strong>\u59cb\u7ec8\u8bb0\u5f97\u5728\u6267\u884c\u4efb\u4f55\u6570\u636e\u5e93\u64cd\u4f5c\u524d\u5907\u4efd\u5173\u952e\u6570\u636e\uff0c\u4ee5\u786e\u4fdd\u6570\u636e\u5b89\u5168<\/strong>\u3002<\/p>\n<\/p>\n<h2><strong>\u76f8\u5173\u95ee\u7b54FAQs\uff1a<\/strong><\/h2>\n<p><strong>\u5982\u4f55\u67e5\u8be2 Mariadb \u6570\u636e\u5e93\u4e2d\u7684\u8868\u683c\uff1f<\/strong><\/p>\n<p>\u8981\u67e5\u8be2 Mariadb \u6570\u636e\u5e93\u4e2d\u7684\u8868\u683c\uff0c\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b\u65b9\u6cd5\uff1a<\/p>\n<ol>\n<li>\u4f7f\u7528\u547d\u4ee4\u884c\u767b\u5f55\u5230 Mariadb \u6570\u636e\u5e93\u3002\u5728\u547d\u4ee4\u63d0\u793a\u7b26\u4e0b\u8f93\u5165 <code>mysql -u \u7528\u6237\u540d -p<\/code> \uff08\u7528\u6237\u540d\u662f\u60a8\u7684 MariaDB \u7528\u6237\u540d\uff09\uff0c\u7136\u540e\u952e\u5165\u5bc6\u7801\u5e76\u6309\u4e0b\u56de\u8f66\u952e\u3002<\/li>\n<li>\u8f93\u5165 <code>USE \u6570\u636e\u5e93\u540d\u79f0<\/code> \u547d\u4ee4\u6765\u9009\u62e9\u8981\u67e5\u8be2\u7684\u6570\u636e\u5e93\u3002<\/li>\n<li>\u8f93\u5165 <code>SHOW TABLES<\/code> \u547d\u4ee4\uff0c\u5b83\u5c06\u8fd4\u56de\u5f53\u524d\u6570\u636e\u5e93\u4e2d\u7684\u6240\u6709\u8868\u683c\u3002<\/li>\n<\/ol>\n<p><strong>Mariadb\u5982\u4f55\u67e5\u627e\u5177\u6709\u7279\u5b9a\u6570\u636e\u7684\u8868\u683c\uff1f<\/strong><\/p>\n<p>\u5982\u679c\u60a8\u60f3\u8981\u67e5\u627e Mariadb \u6570\u636e\u5e93\u4e2d\u5305\u542b\u7279\u5b9a\u6570\u636e\u7684\u8868\u683c\uff0c\u53ef\u4ee5\u6309\u7167\u4ee5\u4e0b\u6b65\u9aa4\u8fdb\u884c\u64cd\u4f5c\uff1a<\/p>\n<ol>\n<li>\u4f7f\u7528\u547d\u4ee4\u884c\u767b\u5f55\u5230 Mariadb \u6570\u636e\u5e93\u3002<\/li>\n<li>\u9009\u62e9\u8981\u67e5\u8be2\u7684\u6570\u636e\u5e93\uff0c\u4f7f\u7528 <code>USE \u6570\u636e\u5e93\u540d\u79f0<\/code> \u547d\u4ee4\u3002<\/li>\n<li>\u8f93\u5165 <code>SHOW TABLES<\/code> \u547d\u4ee4\u6765\u83b7\u53d6\u5f53\u524d\u6570\u636e\u5e93\u4e2d\u7684\u6240\u6709\u8868\u683c\u3002<\/li>\n<li>\u5bf9\u4e8e\u6bcf\u4e2a\u8868\u683c\uff0c\u4f7f\u7528 <code>SELECT * FROM \u8868\u683c\u540d\u79f0 WHERE \u5217\u540d = &#039;\u8981\u67e5\u627e\u7684\u6570\u636e&#039;<\/code> \u547d\u4ee4\u3002\u5c06 &#039;\u8981\u67e5\u627e\u7684\u6570\u636e&#039; \u66ff\u6362\u4e3a\u60a8\u8981\u67e5\u627e\u7684\u5b9e\u9645\u6570\u503c\uff0c\u5e76\u5c06\u5217\u540d\u66ff\u6362\u4e3a\u5305\u542b\u6b64\u6570\u503c\u7684\u5217\u7684\u540d\u79f0\u3002\u6267\u884c\u6b64\u547d\u4ee4\u540e\uff0c\u5982\u679c\u8fd4\u56de\u7ed3\u679c\u4e3a\u7a7a\uff0c\u5219\u8868\u793a\u8be5\u8868\u683c\u4e0d\u5305\u542b\u6b64\u6570\u636e\u3002<\/li>\n<\/ol>\n<p><strong>\u5982\u4f55\u5217\u51fa Mariadb \u6570\u636e\u5e93\u4e2d\u7684\u6240\u6709\u6570\u636e\u5e93\uff1f<\/strong><\/p>\n<p>\u8981\u5217\u51fa Mariadb \u6570\u636e\u5e93\u670d\u52a1\u5668\u4e0a\u7684\u6240\u6709\u6570\u636e\u5e93\uff0c\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b\u65b9\u6cd5\uff1a<\/p>\n<ol>\n<li>\u4f7f\u7528\u547d\u4ee4\u884c\u767b\u5f55\u5230 Mariadb \u6570\u636e\u5e93\u3002<\/li>\n<li>\u8f93\u5165 <code>SHOW DATABASES<\/code> \u547d\u4ee4\u3002\u8fd9\u5c06\u8fd4\u56de\u670d\u52a1\u5668\u4e0a\u6240\u6709\u53ef\u7528\u7684\u6570\u636e\u5e93\u5217\u8868\uff0c\u5305\u62ec\u7cfb\u7edf\u6570\u636e\u5e93\u548c\u7528\u6237\u521b\u5efa\u7684\u6570\u636e\u5e93\u3002<\/li>\n<\/ol>\n","protected":false},"excerpt":{"rendered":"\u67e5\u770bMariaDB\u4e2d\u7684\u6570\u636e\u5e93\u4e3b\u8981\u901a\u8fc7SQL\u8bed\u53e5SHOW DATABASES\u5b8c\u6210\uff0c\u8be5\u547d\u4ee4\u5c06\u5217\u51fa\u6570\u636e\u5e93\u670d\u52a1\u5668\u4e0a\u6240\u6709 [&hellip;]","protected":false},"author":3,"featured_media":135178,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[37],"tags":[],"acf":[],"_links":{"self":[{"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/135172"}],"collection":[{"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/comments?post=135172"}],"version-history":[{"count":0,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/135172\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/media\/135178"}],"wp:attachment":[{"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/media?parent=135172"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/categories?post=135172"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/tags?post=135172"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}