{"id":1964,"date":"2020-07-29T21:46:33","date_gmt":"2020-07-29T13:46:33","guid":{"rendered":"http:\/\/39.97.231.10\/?p=1964"},"modified":"2020-07-29T21:46:33","modified_gmt":"2020-07-29T13:46:33","slug":"postgresql%e5%91%bd%e4%bb%a4psql%e8%bf%9e%e6%8e%a5%e6%95%b0%e6%8d%ae%e5%ba%93","status":"publish","type":"post","link":"http:\/\/www.weijing.co\/?p=1964","title":{"rendered":"PostgreSQL\u547d\u4ee4psql\u8fde\u63a5\u6570\u636e\u5e93"},"content":{"rendered":"<div class=\\\"blog_title\\\">\n<div>\n<span style=\\\"font-size: 1rem;\\\">\u5728\u5b89\u88c5\u5b8c\u6210PostgreSQL\u4e4b\u540e\uff0c\u901a\u8fc7initdb\u547d\u4ee4\u521d\u59cb\u5316\u4e00\u4e2a\u65b0\u7684\u6570\u636e\u5e93\u5b9e\u4f8b\uff0c\u542f\u52a8\u6570\u636e\u5e93\uff0c\u7136\u540e\u5c31\u53ef\u4ee5\u8fde\u63a5\u5e76\u8bbf\u95ee\u6570\u636e\u5e93\u4e86\u3002PostgreSQL\u63d0\u4f9b\u4e86\u547d\u4ee4\u884c\u8fde\u63a5\u5de5\u5177psql\uff0c\u63d0\u4f9b\u4e86\u529f\u80fd\u5f3a\u5927\u7684\u8bbf\u95ee\u6570\u636e\u5e93\u7684\u80fd\u529b\u3002<\/span>\n<\/div>\n<\/div>\n<div class=\\\"blog_content\\\">\n<div class=\\\"blog_detail\\\">\n<h5>1. \u8fde\u63a5\u672c\u5730\u6570\u636e\u5e93<\/h5>\n<ol>\n<li>\u5207\u6362\u5230pg\u7528\u6237<br \/>\nsu &#8211; pg<\/li>\n<li>\u521b\u5efa\u6570\u636e\u5e93<br \/>\ncreatedb mydb<\/li>\n<li>\u8fde\u63a5\u6570\u636e\u5e93<br \/>\npsql mydb<br \/>\n\u51fa\u73b0\u4ee5\u4e0b\u547d\u4ee4\u63d0\u793a\u7b26\uff0c\u8bf4\u660e\u5df2\u7ecf\u6210\u529f\u8fde\u4e0a\u6570\u636e\u5e93\u4e86\u3002<\/p>\n<pre><code>[pg@localhost ~]$ psql mydb\npsql (11.5)\nType \\\"help\\\" for help.\nmydb=#\n<\/code><\/pre>\n<\/li>\n<li>\u9000\u51fa\u8fde\u63a5<br \/>\nexit<\/li>\n<\/ol>\n<p>\u8fde\u63a5\u672c\u5730\u6570\u636e\u5e93\u7684\u5b8c\u6574\u53c2\u6570\uff1a<br \/>\npsql -h \/tmp\/ -p 5433 -U pg -d postgres -W<br \/>\n-h \u6307\u5b9a\u672c\u5730socket\u76ee\u5f55<br \/>\n-p \u6307\u5b9a\u7aef\u53e3\u53f7<br \/>\n-U \u6307\u5b9a\u7528\u6237\u540d<br \/>\n-d \u6307\u5b9a\u6570\u636e\u5e93\u540d\u79f0<br \/>\n-W \u6307\u5b9a\u7ec8\u7aef\u63d0\u793a\u7b26\u4e0b\u8f93\u5165\u5bc6\u7801<\/p>\n<h5>2. \u8fde\u63a5\u8fdc\u7a0b\u6570\u636e\u5e93<\/h5>\n<p>psql -h 127.0.0.1 -p 5432 -U pg -d mydb -W<br \/>\n-h \u6307\u5b9a\u8fdc\u7a0b\u6570\u636e\u5e93ip<br \/>\n-p \u6307\u5b9a\u7aef\u53e3\u53f7<br \/>\n-U \u6307\u5b9a\u7528\u6237\u540d<br \/>\n-d \u6307\u5b9a\u6570\u636e\u5e93\u540d\u79f0<br \/>\n-W \u6307\u5b9a\u7ec8\u7aef\u63d0\u793a\u7b26\u4e0b\u8f93\u5165\u5bc6\u7801\n<\/p><\/div>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>\u5728\u5b89\u88c5\u5b8c\u6210PostgreSQL\u4e4b\u540e\uff0c\u901a\u8fc7initdb\u547d\u4ee4\u521d\u59cb\u5316\u4e00\u4e2a\u65b0\u7684\u6570\u636e\u5e93\u5b9e\u4f8b\uff0c\u542f\u52a8\u6570\u636e\u5e93\uff0c\u7136\u540e\u5c31\u53ef\u4ee5\u8fde\u63a5\u5e76 &hellip;<\/p>\n<p class=\"read-more\"> <a class=\"\" href=\"http:\/\/www.weijing.co\/?p=1964\"> <span class=\"screen-reader-text\">PostgreSQL\u547d\u4ee4psql\u8fde\u63a5\u6570\u636e\u5e93<\/span> \u67e5\u770b\u5168\u6587 &raquo;<\/a><\/p>\n","protected":false},"author":4,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"site-sidebar-layout":"default","site-content-layout":"default","ast-main-header-display":"","ast-hfb-above-header-display":"","ast-hfb-below-header-display":"","ast-hfb-mobile-header-display":"","site-post-title":"","ast-breadcrumbs-content":"","ast-featured-img":"","footer-sml-layout":"","theme-transparent-header-meta":"default","adv-header-id-meta":"","stick-header-meta":"","header-above-stick-meta":"","header-main-stick-meta":"","header-below-stick-meta":""},"categories":[134,88],"tags":[],"uagb_featured_image_src":{"full":false,"thumbnail":false,"medium":false,"medium_large":false,"large":false,"1536x1536":false,"2048x2048":false,"mailpoet_newsletter_max":false,"woocommerce_thumbnail":false,"woocommerce_single":false,"woocommerce_gallery_thumbnail":false,"shop_catalog":false,"shop_single":false,"shop_thumbnail":false},"uagb_author_info":{"display_name":"weijing","author_link":"http:\/\/www.weijing.co\/?author=4"},"uagb_comment_info":0,"uagb_excerpt":"\u5728\u5b89\u88c5\u5b8c\u6210PostgreSQL\u4e4b\u540e\uff0c\u901a\u8fc7initdb\u547d\u4ee4\u521d\u59cb\u5316\u4e00\u4e2a\u65b0\u7684\u6570\u636e\u5e93\u5b9e\u4f8b\uff0c\u542f\u52a8\u6570\u636e\u5e93\uff0c\u7136\u540e\u5c31\u53ef\u4ee5\u8fde\u63a5\u5e76&hellip;","_links":{"self":[{"href":"http:\/\/www.weijing.co\/index.php?rest_route=\/wp\/v2\/posts\/1964"}],"collection":[{"href":"http:\/\/www.weijing.co\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.weijing.co\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.weijing.co\/index.php?rest_route=\/wp\/v2\/users\/4"}],"replies":[{"embeddable":true,"href":"http:\/\/www.weijing.co\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1964"}],"version-history":[{"count":0,"href":"http:\/\/www.weijing.co\/index.php?rest_route=\/wp\/v2\/posts\/1964\/revisions"}],"wp:attachment":[{"href":"http:\/\/www.weijing.co\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1964"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.weijing.co\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1964"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.weijing.co\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1964"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}