{"id":41866,"date":"2023-03-24T16:20:43","date_gmt":"2023-10-20T22:37:57","guid":{"rendered":"https:\/\/www.silicloud.com\/zh\/blog\/%e5%9c%a8centos7%e4%b8%8a%e5%ae%89%e8%a3%85postgresql%e7%9a%84%e6%96%b9%e6%b3%95\/"},"modified":"2024-04-29T20:21:25","modified_gmt":"2024-04-29T12:21:25","slug":"%e5%9c%a8centos7%e4%b8%8a%e5%ae%89%e8%a3%85postgresql%e7%9a%84%e6%96%b9%e6%b3%95","status":"publish","type":"post","link":"https:\/\/www.silicloud.com\/zh\/blog\/%e5%9c%a8centos7%e4%b8%8a%e5%ae%89%e8%a3%85postgresql%e7%9a%84%e6%96%b9%e6%b3%95\/","title":{"rendered":"\u5728CentOS7\u4e0a\u5b89\u88c5PostgreSQL\u7684\u65b9\u6cd5"},"content":{"rendered":"<h2>\u5b89\u88c5<\/h2>\n<h3>\u5b89\u88c5PostgreSQL\u670d\u52a1\u5668\u3002<\/h3>\n<p>\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u5b9f\u884c<\/p>\n<p>terminal<br \/>\nyum -y install postgresql-server<\/p>\n<h2>\u8d77\u59cb\u8bbe\u7f6e<\/h2>\n<h3>\u6570\u636e\u5e93\u521d\u59cb\u5316<\/h3>\n<p>\u521d\u671f\u5316\u30b3\u30de\u30f3\u30c9\u3092\u5b9f\u884c\u3002\/var\/lib\/pgsql\/data\u306b\u8a2d\u5b9a\u30d5\u30a1\u30a4\u30eb\u306a\u3069\u304c\u914d\u7f6e\u3055\u308c\u308b\u3002<\/p>\n<p>terminal<br \/>\npostgresql-setup initdb<\/p>\n<h3>\u7f16\u8f91postgresql.conf<\/h3>\n<p>org\u30d5\u30a1\u30a4\u30eb\u30d0\u30c3\u30af\u30a2\u30c3\u30d7 &amp; \u7de8\u96c6<\/p>\n<p>terminal<br \/>\ncd \/var\/lib\/pgsql\/data<br \/>\ncp postgresql.conf postgresql.conf.org<br \/>\necho &#8220;listen_addresses = &#8216;*'&#8221; &gt;&gt; \/var\/lib\/pgsql\/data\/postgresql.conf<\/p>\n<p>\u5dee\u5206\u78ba\u8a8d<\/p>\n<p>terminal<br \/>\ndiff -u postgresql.conf.org postgresql.conf<\/p>\n<p>&#8212; postgresql.conf.org 2017-01-16 16:57:24.904920137 +0900<br \/>\n+++ postgresql.conf 2017-01-16 17:00:13.670101306 +0900<br \/>\n@@ -575,3 +575,4 @@<br \/>\n#&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;<\/p>\n<p># Add settings for extensions here<br \/>\n+listen_addresses = &#8216;*&#8217;<\/p>\n<h3>\u7f16\u8f91pg_hba.conf\u6587\u4ef6\u3002<\/h3>\n<p>org\u30d5\u30a1\u30a4\u30eb\u30d0\u30c3\u30af\u30a2\u30c3\u30d7 &amp; \u7de8\u96c6<\/p>\n<p>terminal<br \/>\ncd \/var\/lib\/pgsql\/data<br \/>\ncp pg_hba.conf pg_hba.conf.org<\/p>\n<p>echo &#8220;# PostgreSQL Client Authentication Configuration File&#8221; &gt; .\/pg_hba.conf<br \/>\necho &#8220;# ===================================================&#8221; &gt;&gt; .\/pg_hba.conf<br \/>\necho &#8220;local all all trust&#8221; &gt;&gt; .\/pg_hba.conf<br \/>\necho &#8220;host all all 127.0.0.1\/32 trust&#8221; &gt;&gt; .\/pg_hba.conf<br \/>\necho &#8220;host all all ::1\/128 trust&#8221; &gt;&gt; .\/pg_hba.conf<\/p>\n<p>\u78ba\u8a8d (org\u306f\u30b3\u30e1\u30f3\u30c8\u3060\u3089\u3051\u3067diff\u53d6\u308b\u3068\u9577\u304f\u306a\u308b\u306e\u3067\u3001\u5909\u66f4\u5f8c\u306e\u5185\u5bb9\u306e\u307f)<\/p>\n<p>terminal<br \/>\ncat pg_hba.conf<\/p>\n<p># PostgreSQL Client Authentication Configuration File<br \/>\n# ===================================================<br \/>\nlocal all all trust<br \/>\nhost all all 127.0.0.1\/32 trust<br \/>\nhost all all ::1\/128 trust<\/p>\n<h2>\u5f00\u673a<\/h2>\n<h3>\u542f\u52a8PostgreSQL<\/h3>\n<p>\u8d77\u52d5\u30b3\u30de\u30f3\u30c9\u5b9f\u884c<\/p>\n<p>terminal<br \/>\nservice postgresql restart<\/p>\n<h2>\u786e\u8ba4\u8fde\u63a5<\/h2>\n<h3>\u786e\u8ba4\u80fd\u591f\u8fde\u63a5\u5230PostgreSQL<\/h3>\n<p>local\u63a5\u7d9a\u306e\u53ef\u5426\u3092\u78ba\u8a8d<\/p>\n<p>terminal<br \/>\npsql -U postgres -h 127.0.0.1 -w<\/p>\n<p>psql (9.2.18)<br \/>\n&#8220;help&#8221; \u3067\u30d8\u30eb\u30d7\u3092\u8868\u793a\u3057\u307e\u3059.<\/p>\n<p>postgres=#<\/p>\n<h3>\u66f4\u6539postgres\u7528\u6237\u7684\u5bc6\u7801<\/h3>\n<p>SQL\u3092\u5b9f\u884c<\/p>\n<p>terminal<br \/>\npsql -U postgres -c &#8220;ALTER ROLE postgres WITH PASSWORD &#8216;your-secure-password'&#8221;<\/p>\n<p>ALTER ROLE<\/p>\n<h3>\u521b\u5efa\u6570\u636e\u5e93<\/h3>\n<p>SQL\u3092\u5b9f\u884c<\/p>\n<p>terminal<br \/>\npsql -U postgres -W -c &#8220;CREATE DATABASE your_database_name&#8221;;<br \/>\n\u30e6\u30fc\u30b6 postgres \u306e\u30d1\u30b9\u30ef\u30fc\u30c9:<\/p>\n<p>CREATE DATABASE<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u5b89\u88c5 \u5b89\u88c5PostgreSQL\u670d\u52a1\u5668\u3002 \u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u5b9f\u884c terminal yum -y install po [&hellip;]<\/p>\n","protected":false},"author":8,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-41866","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v21.5 (Yoast SEO v21.5) - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>\u5728CentOS7\u4e0a\u5b89\u88c5PostgreSQL\u7684\u65b9\u6cd5 - Blog - Silicon Cloud<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.silicloud.com\/zh\/blog\/\u5728centos7\u4e0a\u5b89\u88c5postgresql\u7684\u65b9\u6cd5\/\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"\u5728CentOS7\u4e0a\u5b89\u88c5PostgreSQL\u7684\u65b9\u6cd5\" \/>\n<meta property=\"og:description\" content=\"\u5b89\u88c5 \u5b89\u88c5PostgreSQL\u670d\u52a1\u5668\u3002 \u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u5b9f\u884c terminal yum -y install po [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.silicloud.com\/zh\/blog\/\u5728centos7\u4e0a\u5b89\u88c5postgresql\u7684\u65b9\u6cd5\/\" \/>\n<meta property=\"og:site_name\" content=\"Blog - Silicon Cloud\" \/>\n<meta property=\"article:published_time\" content=\"2023-10-20T22:37:57+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2024-04-29T12:21:25+00:00\" \/>\n<meta name=\"author\" content=\"\u96c5, \u609f\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"\u4f5c\u8005\" \/>\n\t<meta name=\"twitter:data1\" content=\"\u96c5, \u609f\" \/>\n\t<meta name=\"twitter:label2\" content=\"\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4\" \/>\n\t<meta name=\"twitter:data2\" content=\"1 \u5206\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/%e5%9c%a8centos7%e4%b8%8a%e5%ae%89%e8%a3%85postgresql%e7%9a%84%e6%96%b9%e6%b3%95\/\",\"url\":\"https:\/\/www.silicloud.com\/zh\/blog\/%e5%9c%a8centos7%e4%b8%8a%e5%ae%89%e8%a3%85postgresql%e7%9a%84%e6%96%b9%e6%b3%95\/\",\"name\":\"\u5728CentOS7\u4e0a\u5b89\u88c5PostgreSQL\u7684\u65b9\u6cd5 - Blog - Silicon Cloud\",\"isPartOf\":{\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/#website\"},\"datePublished\":\"2023-10-20T22:37:57+00:00\",\"dateModified\":\"2024-04-29T12:21:25+00:00\",\"author\":{\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/#\/schema\/person\/f044a4b7fa4ee2701702942002419ca6\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/%e5%9c%a8centos7%e4%b8%8a%e5%ae%89%e8%a3%85postgresql%e7%9a%84%e6%96%b9%e6%b3%95\/#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.silicloud.com\/zh\/blog\/%e5%9c%a8centos7%e4%b8%8a%e5%ae%89%e8%a3%85postgresql%e7%9a%84%e6%96%b9%e6%b3%95\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/%e5%9c%a8centos7%e4%b8%8a%e5%ae%89%e8%a3%85postgresql%e7%9a%84%e6%96%b9%e6%b3%95\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"https:\/\/www.silicloud.com\/zh\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"\u5728CentOS7\u4e0a\u5b89\u88c5PostgreSQL\u7684\u65b9\u6cd5\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/#website\",\"url\":\"https:\/\/www.silicloud.com\/zh\/blog\/\",\"name\":\"Blog - Silicon Cloud\",\"description\":\"\",\"inLanguage\":\"zh-Hans\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/#\/schema\/person\/f044a4b7fa4ee2701702942002419ca6\",\"name\":\"\u96c5, \u609f\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-Hans\",\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/e71a913e914f1aad1efc391f92084294bac54bc782acd289638580134cf667a6?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/e71a913e914f1aad1efc391f92084294bac54bc782acd289638580134cf667a6?s=96&d=mm&r=g\",\"caption\":\"\u96c5, \u609f\"},\"url\":\"https:\/\/www.silicloud.com\/zh\/blog\/author\/yawu\/\"},{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-Hans\",\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/%e5%9c%a8centos7%e4%b8%8a%e5%ae%89%e8%a3%85postgresql%e7%9a%84%e6%96%b9%e6%b3%95\/#local-main-organization-logo\",\"url\":\"\",\"contentUrl\":\"\",\"caption\":\"Blog - Silicon Cloud\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"\u5728CentOS7\u4e0a\u5b89\u88c5PostgreSQL\u7684\u65b9\u6cd5 - Blog - Silicon Cloud","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.silicloud.com\/zh\/blog\/\u5728centos7\u4e0a\u5b89\u88c5postgresql\u7684\u65b9\u6cd5\/","og_locale":"zh_CN","og_type":"article","og_title":"\u5728CentOS7\u4e0a\u5b89\u88c5PostgreSQL\u7684\u65b9\u6cd5","og_description":"\u5b89\u88c5 \u5b89\u88c5PostgreSQL\u670d\u52a1\u5668\u3002 \u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u5b9f\u884c terminal yum -y install po [&hellip;]","og_url":"https:\/\/www.silicloud.com\/zh\/blog\/\u5728centos7\u4e0a\u5b89\u88c5postgresql\u7684\u65b9\u6cd5\/","og_site_name":"Blog - Silicon Cloud","article_published_time":"2023-10-20T22:37:57+00:00","article_modified_time":"2024-04-29T12:21:25+00:00","author":"\u96c5, \u609f","twitter_card":"summary_large_image","twitter_misc":{"\u4f5c\u8005":"\u96c5, \u609f","\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4":"1 \u5206"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.silicloud.com\/zh\/blog\/%e5%9c%a8centos7%e4%b8%8a%e5%ae%89%e8%a3%85postgresql%e7%9a%84%e6%96%b9%e6%b3%95\/","url":"https:\/\/www.silicloud.com\/zh\/blog\/%e5%9c%a8centos7%e4%b8%8a%e5%ae%89%e8%a3%85postgresql%e7%9a%84%e6%96%b9%e6%b3%95\/","name":"\u5728CentOS7\u4e0a\u5b89\u88c5PostgreSQL\u7684\u65b9\u6cd5 - Blog - Silicon Cloud","isPartOf":{"@id":"https:\/\/www.silicloud.com\/zh\/blog\/#website"},"datePublished":"2023-10-20T22:37:57+00:00","dateModified":"2024-04-29T12:21:25+00:00","author":{"@id":"https:\/\/www.silicloud.com\/zh\/blog\/#\/schema\/person\/f044a4b7fa4ee2701702942002419ca6"},"breadcrumb":{"@id":"https:\/\/www.silicloud.com\/zh\/blog\/%e5%9c%a8centos7%e4%b8%8a%e5%ae%89%e8%a3%85postgresql%e7%9a%84%e6%96%b9%e6%b3%95\/#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.silicloud.com\/zh\/blog\/%e5%9c%a8centos7%e4%b8%8a%e5%ae%89%e8%a3%85postgresql%e7%9a%84%e6%96%b9%e6%b3%95\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.silicloud.com\/zh\/blog\/%e5%9c%a8centos7%e4%b8%8a%e5%ae%89%e8%a3%85postgresql%e7%9a%84%e6%96%b9%e6%b3%95\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"https:\/\/www.silicloud.com\/zh\/blog\/"},{"@type":"ListItem","position":2,"name":"\u5728CentOS7\u4e0a\u5b89\u88c5PostgreSQL\u7684\u65b9\u6cd5"}]},{"@type":"WebSite","@id":"https:\/\/www.silicloud.com\/zh\/blog\/#website","url":"https:\/\/www.silicloud.com\/zh\/blog\/","name":"Blog - Silicon Cloud","description":"","inLanguage":"zh-Hans"},{"@type":"Person","@id":"https:\/\/www.silicloud.com\/zh\/blog\/#\/schema\/person\/f044a4b7fa4ee2701702942002419ca6","name":"\u96c5, \u609f","image":{"@type":"ImageObject","inLanguage":"zh-Hans","@id":"https:\/\/www.silicloud.com\/zh\/blog\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/e71a913e914f1aad1efc391f92084294bac54bc782acd289638580134cf667a6?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/e71a913e914f1aad1efc391f92084294bac54bc782acd289638580134cf667a6?s=96&d=mm&r=g","caption":"\u96c5, \u609f"},"url":"https:\/\/www.silicloud.com\/zh\/blog\/author\/yawu\/"},{"@type":"ImageObject","inLanguage":"zh-Hans","@id":"https:\/\/www.silicloud.com\/zh\/blog\/%e5%9c%a8centos7%e4%b8%8a%e5%ae%89%e8%a3%85postgresql%e7%9a%84%e6%96%b9%e6%b3%95\/#local-main-organization-logo","url":"","contentUrl":"","caption":"Blog - Silicon Cloud"}]}},"_links":{"self":[{"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/posts\/41866","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/users\/8"}],"replies":[{"embeddable":true,"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/comments?post=41866"}],"version-history":[{"count":2,"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/posts\/41866\/revisions"}],"predecessor-version":[{"id":87436,"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/posts\/41866\/revisions\/87436"}],"wp:attachment":[{"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/media?parent=41866"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/categories?post=41866"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/tags?post=41866"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}