{"id":185886,"date":"2024-11-11T01:19:27","date_gmt":"2024-11-10T17:19:27","guid":{"rendered":"https:\/\/server.hk\/cnblog\/185886\/"},"modified":"2024-11-11T01:19:28","modified_gmt":"2024-11-10T17:19:28","slug":"%e6%95%b8%e6%93%9a%e5%ba%abshell%e4%b8%80%e8%a6%bd%e6%b8%85%e5%96%ae%ef%bc%88%e7%be%85%e5%88%97%e6%89%80%e6%9c%89%e6%95%b8%e6%93%9a%e5%ba%abshell%ef%bc%89","status":"publish","type":"post","link":"https:\/\/server.hk\/cnblog\/185886\/","title":{"rendered":"\u6578\u64da\u5eabshell\u4e00\u89bd\u6e05\u55ae\uff08\u7f85\u5217\u6240\u6709\u6578\u64da\u5eabshell\uff09"},"content":{"rendered":"<h1 id=\"%e6%95%b8%e6%93%9a%e5%ba%abshell%e4%b8%80%e8%a6%bd%e6%b8%85%e5%96%ae%ef%bc%88%e7%be%85%e5%88%97%e6%89%80%e6%9c%89%e6%95%b8%e6%93%9a%e5%ba%abshell%ef%bc%89-yGXacxMvfo\">\u6578\u64da\u5eabShell\u4e00\u89bd\u6e05\u55ae\uff08\u7f85\u5217\u6240\u6709\u6578\u64da\u5eabShell\uff09<\/h1>\n<p>\u5728\u73fe\u4ee3\u7684\u7db2\u7d61\u61c9\u7528\u4e2d\uff0c\u6578\u64da\u5eab\u626e\u6f14\u8457\u81f3\u95dc\u91cd\u8981\u7684\u89d2\u8272\u3002\u7121\u8ad6\u662f\u7db2\u7ad9\u3001\u61c9\u7528\u7a0b\u5e8f\u9084\u662f\u4f01\u696d\u7cfb\u7d71\uff0c\u6578\u64da\u5eab\u90fd\u662f\u5b58\u5132\u548c\u7ba1\u7406\u6578\u64da\u7684\u6838\u5fc3\u3002\u70ba\u4e86\u6709\u6548\u5730\u8207\u6578\u64da\u5eab\u9032\u884c\u4ea4\u4e92\uff0c\u958b\u767c\u8005\u548c\u7cfb\u7d71\u7ba1\u7406\u54e1\u901a\u5e38\u9700\u8981\u4f7f\u7528\u5404\u7a2e\u6578\u64da\u5eabShell\u3002\u672c\u6587\u5c07\u70ba\u60a8\u63d0\u4f9b\u4e00\u500b\u5168\u9762\u7684\u6578\u64da\u5eabShell\u4e00\u89bd\u6e05\u55ae\uff0c\u5e6b\u52a9\u60a8\u66f4\u597d\u5730\u7406\u89e3\u548c\u4f7f\u7528\u9019\u4e9b\u5de5\u5177\u3002<\/p>\n<h2 id=\"%e4%bb%80%e9%ba%bc%e6%98%af%e6%95%b8%e6%93%9a%e5%ba%abshell%ef%bc%9f-yGXacxMvfo\">\u4ec0\u9ebc\u662f\u6578\u64da\u5eabShell\uff1f<\/h2>\n<p>\u6578\u64da\u5eabShell\u662f\u4e00\u7a2e\u547d\u4ee4\u884c\u754c\u9762\uff0c\u5141\u8a31\u7528\u6236\u8207\u6578\u64da\u5eab\u9032\u884c\u4ea4\u4e92\u3002\u901a\u904eShell\uff0c\u7528\u6236\u53ef\u4ee5\u57f7\u884c\u67e5\u8a62\u3001\u7ba1\u7406\u6578\u64da\u3001\u8a2d\u7f6e\u6b0a\u9650\u7b49\u64cd\u4f5c\u3002\u4e0d\u540c\u7684\u6578\u64da\u5eab\u7cfb\u7d71\u6709\u5404\u81ea\u7684Shell\u5de5\u5177\uff0c\u9019\u4e9b\u5de5\u5177\u63d0\u4f9b\u4e86\u7279\u5b9a\u7684\u547d\u4ee4\u548c\u529f\u80fd\u3002<\/p>\n<h2 id=\"%e5%b8%b8%e8%a6%8b%e7%9a%84%e6%95%b8%e6%93%9a%e5%ba%abshell-yGXacxMvfo\">\u5e38\u898b\u7684\u6578\u64da\u5eabShell<\/h2>\n<ul>\n<li>\n<h3 id=\"mysql-shell-yGXacxMvfo\">MySQL Shell<\/h3>\n<\/li>\n<p>MySQL\u662f\u4e00\u500b\u6d41\u884c\u7684\u958b\u6e90\u6578\u64da\u5eab\u7ba1\u7406\u7cfb\u7d71\uff0c\u5176Shell\u5de5\u5177\u63d0\u4f9b\u4e86\u5f37\u5927\u7684\u67e5\u8a62\u548c\u7ba1\u7406\u529f\u80fd\u3002\u7528\u6236\u53ef\u4ee5\u901a\u904e\u4ee5\u4e0b\u547d\u4ee4\u9032\u5165MySQL Shell\uff1a<\/p>\n<pre><code>mysql -u username -p<\/code><\/pre>\n<p>\u5728Shell\u4e2d\uff0c\u60a8\u53ef\u4ee5\u57f7\u884c\u5404\u7a2eSQL\u67e5\u8a62\uff0c\u4f8b\u5982\uff1a<\/p>\n<pre><code>SELECT * FROM users;<\/code><\/pre>\n<li>\n<h3 id=\"postgresql-shell-psql-yGXacxMvfo\">PostgreSQL Shell (psql)<\/h3>\n<\/li>\n<p>PostgreSQL\u662f\u4e00\u500b\u529f\u80fd\u5f37\u5927\u7684\u958b\u6e90\u95dc\u4fc2\u578b\u6578\u64da\u5eab\uff0c\u5176Shell\u5de5\u5177psql\u63d0\u4f9b\u4e86\u8c50\u5bcc\u7684\u529f\u80fd\u3002\u7528\u6236\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\u9032\u5165psql\uff1a<\/p>\n<pre><code>psql -U username -d database_name<\/code><\/pre>\n<p>\u5728psql\u4e2d\uff0c\u60a8\u53ef\u4ee5\u57f7\u884c\u67e5\u8a62\u548c\u7ba1\u7406\u64cd\u4f5c\uff0c\u4f8b\u5982\uff1a<\/p>\n<pre><code>SELECT * FROM products;<\/code><\/pre>\n<li>\n<h3 id=\"mongodb-shell-mongo-yGXacxMvfo\">MongoDB Shell (mongo)<\/h3>\n<\/li>\n<p>MongoDB\u662f\u4e00\u500b\u6d41\u884c\u7684NoSQL\u6578\u64da\u5eab\uff0c\u5176Shell\u5de5\u5177mongo\u5141\u8a31\u7528\u6236\u4ee5\u6587\u6a94\u70ba\u4e2d\u5fc3\u7684\u65b9\u5f0f\u9032\u884c\u6578\u64da\u64cd\u4f5c\u3002\u7528\u6236\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\u9032\u5165mongo\uff1a<\/p>\n<pre><code>mongo<\/code><\/pre>\n<p>\u5728mongo\u4e2d\uff0c\u60a8\u53ef\u4ee5\u57f7\u884c\u67e5\u8a62\uff0c\u4f8b\u5982\uff1a<\/p>\n<pre><code>db.users.find();<\/code><\/pre>\n<li>\n<h3 id=\"sqlite-shell-yGXacxMvfo\">SQLite Shell<\/h3>\n<\/li>\n<p>SQLite\u662f\u4e00\u500b\u8f15\u91cf\u7d1a\u7684\u5d4c\u5165\u5f0f\u6578\u64da\u5eab\uff0c\u5176Shell\u5de5\u5177\u63d0\u4f9b\u4e86\u7c21\u55ae\u7684\u547d\u4ee4\u884c\u754c\u9762\u3002\u7528\u6236\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\u9032\u5165SQLite Shell\uff1a<\/p>\n<pre><code>sqlite3 database_name.db<\/code><\/pre>\n<p>\u5728SQLite\u4e2d\uff0c\u60a8\u53ef\u4ee5\u57f7\u884c\u67e5\u8a62\uff0c\u4f8b\u5982\uff1a<\/p>\n<pre><code>SELECT * FROM orders;<\/code><\/pre>\n<li>\n<h3 id=\"oracle-sqlplus-yGXacxMvfo\">Oracle SQL*Plus<\/h3>\n<\/li>\n<p>Oracle\u6578\u64da\u5eab\u7684SQL*Plus\u662f\u4e00\u500b\u5f37\u5927\u7684\u547d\u4ee4\u884c\u5de5\u5177\uff0c\u5141\u8a31\u7528\u6236\u57f7\u884cSQL\u67e5\u8a62\u548cPL\/SQL\u7a0b\u5e8f\u3002\u7528\u6236\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\u9032\u5165SQL*Plus\uff1a<\/p>\n<pre><code>sqlplus username\/password<\/code><\/pre>\n<p>\u5728SQL*Plus\u4e2d\uff0c\u60a8\u53ef\u4ee5\u57f7\u884c\u67e5\u8a62\uff0c\u4f8b\u5982\uff1a<\/p>\n<pre><code>SELECT * FROM employees;<\/code><\/pre>\n<\/ul>\n<h2 id=\"%e5%a6%82%e4%bd%95%e9%81%b8%e6%93%87%e5%90%88%e9%81%a9%e7%9a%84%e6%95%b8%e6%93%9a%e5%ba%abshell-yGXacxMvfo\">\u5982\u4f55\u9078\u64c7\u5408\u9069\u7684\u6578\u64da\u5eabShell<\/h2>\n<p>\u9078\u64c7\u5408\u9069\u7684\u6578\u64da\u5eabShell\u53d6\u6c7a\u65bc\u591a\u500b\u56e0\u7d20\uff0c\u5305\u62ec\u60a8\u7684\u6578\u64da\u5eab\u985e\u578b\u3001\u4f7f\u7528\u9700\u6c42\u548c\u500b\u4eba\u504f\u597d\u3002\u4ee5\u4e0b\u662f\u4e00\u4e9b\u9078\u64c7\u5efa\u8b70\uff1a<\/p>\n<ul>\n<li><strong>\u6578\u64da\u5eab\u985e\u578b\uff1a<\/strong>\u78ba\u4fdd\u9078\u64c7\u7684Shell\u8207\u60a8\u4f7f\u7528\u7684\u6578\u64da\u5eab\u7cfb\u7d71\u517c\u5bb9\u3002<\/li>\n<li><strong>\u529f\u80fd\u9700\u6c42\uff1a<\/strong>\u6839\u64da\u60a8\u7684\u9700\u6c42\u9078\u64c7\u5177\u6709\u76f8\u61c9\u529f\u80fd\u7684Shell\uff0c\u4f8b\u5982\u652f\u6301\u8907\u96dc\u67e5\u8a62\u6216\u6578\u64da\u5c0e\u5165\u5c0e\u51fa\u3002<\/li>\n<li><strong>\u4f7f\u7528\u7fd2\u6163\uff1a<\/strong>\u8003\u616e\u60a8\u5c0d\u547d\u4ee4\u884c\u64cd\u4f5c\u7684\u719f\u6089\u7a0b\u5ea6\uff0c\u9078\u64c7\u6613\u65bc\u4f7f\u7528\u7684Shell\u3002<\/li>\n<\/ul>\n<h2 id=\"%e7%b8%bd%e7%b5%90-yGXacxMvfo\">\u7e3d\u7d50<\/h2>\n<p>\u6578\u64da\u5eabShell\u662f\u8207\u6578\u64da\u5eab\u9032\u884c\u4ea4\u4e92\u7684\u91cd\u8981\u5de5\u5177\uff0c\u4e86\u89e3\u5404\u7a2e\u6578\u64da\u5eabShell\u7684\u529f\u80fd\u548c\u4f7f\u7528\u65b9\u6cd5\u5c0d\u65bc\u958b\u767c\u8005\u548c\u7cfb\u7d71\u7ba1\u7406\u54e1\u4f86\u8aaa\u81f3\u95dc\u91cd\u8981\u3002\u7121\u8ad6\u60a8\u662f\u4f7f\u7528MySQL\u3001PostgreSQL\u3001MongoDB\u3001SQLite\u9084\u662fOracle\uff0c\u638c\u63e1\u9019\u4e9bShell\u7684\u57fa\u672c\u64cd\u4f5c\u90fd\u80fd\u63d0\u9ad8\u60a8\u7684\u5de5\u4f5c\u6548\u7387\u3002\u5982\u679c\u60a8\u9700\u8981\u9ad8\u6548\u7684\u6578\u64da\u5eab\u89e3\u6c7a\u65b9\u6848\uff0c\u8003\u616e\u4f7f\u7528<a href=\"https:\/\/server.hk\">\u9999\u6e2fVPS<\/a>\u4f86\u90e8\u7f72\u60a8\u7684\u6578\u64da\u5eab\uff0c\u4eab\u53d7\u7a69\u5b9a\u548c\u5b89\u5168\u7684\u670d\u52d9\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u63a2\u7d22\u5404\u7a2e\u6578\u64da\u5eabshell\u7684\u5b8c\u6574\u6e05\u55ae\uff0c\u6db5\u84cb\u4e3b\u6d41\u6578\u64da\u5eab\u5de5\u5177\uff0c\u52a9\u60a8\u8f15\u9b06\u9078\u64c7\u5408\u9069\u7684\u6578\u64da\u7ba1\u7406\u89e3\u6c7a\u65b9\u6848\u3002<\/p>\n","protected":false},"author":0,"featured_media":0,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[101],"tags":[],"class_list":["post-185886","post","type-post","status-publish","format-standard","hentry","category-database"],"_links":{"self":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/185886","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/types\/post"}],"replies":[{"embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/comments?post=185886"}],"version-history":[{"count":1,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/185886\/revisions"}],"predecessor-version":[{"id":185887,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/185886\/revisions\/185887"}],"wp:attachment":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/media?parent=185886"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/categories?post=185886"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/tags?post=185886"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}