{"id":8691,"date":"2020-09-22T17:29:16","date_gmt":"2020-09-22T09:29:16","guid":{"rendered":"https:\/\/www.linuxcool.com\/?p=8691"},"modified":"2020-09-22T17:29:16","modified_gmt":"2020-09-22T09:29:16","slug":"createdb","status":"publish","type":"post","link":"https:\/\/www.linuxcool.com\/createdb","title":{"rendered":"createdb\u547d\u4ee4 – \u521b\u5efaPostgreSQL\u6570\u636e\u5e93"},"content":{"rendered":"\n

createdb\u547d\u4ee4\u7684\u4f5c\u7528\u662f\u53ef\u4ee5\u521b\u5efa\u4e00\u4e2aPostgreSQL\u6570\u636e\u5e93\u3002<\/p>\n\n\n\n

PostgreSQL\u662f\u4e00\u4e2a\u529f\u80fd\u975e\u5e38\u5f3a\u5927\u7684\u3001\u6e90\u4ee3\u7801\u5f00\u653e\u7684\u5ba2\u6237\/\u670d\u52a1\u5668\u5173\u7cfb\u578b\u6570\u636e\u5e93\u7ba1\u7406\u7cfb\u7edf\uff08RDBMS\uff09\u3002 PostgreSQL\u6570\u636e\u5e93\u652f\u6301\u7075\u6d3b\u7684\u6743\u9650\u7ba1\u7406\uff0c\u53ef\u4ee5\u63a7\u5236\u4e00\u4e2a\u89d2\u8272\uff08\u7ec4\u3001\u7528\u6237\uff09\u5bf9\u67d0\u5f20\u8868\u7684\u8bfb\u3001\u5199\u3001\u66f4\u65b0\u3001\u5220\u9664\u7b49\u64cd\u4f5c\u6743\u9650\u3001\u6267\u884c\u67d0\u4e2a\u51fd\u6570\u7684\u6743\u9650\u4ee5\u53ca\u64cd\u4f5c\uff08\u4f7f\u7528\u3001\u66f4\u65b0\u7b49\uff09\u89c6\u56fe\u3001\u5e8f\u5217\u7684\u6743\u9650\u3002<\/p>\n\n\n\n

\u901a\u5e38\uff0c\u6267\u884c\u8fd9\u4e2a\u547d\u4ee4\u7684\u6570\u636e\u5e93\u7528\u6237\u6210\u4e3a\u65b0\u6570\u636e\u5e93\u7684\u6240\u6709\u8005\u3002 \u4e0d\u8fc7\uff0c\u5982\u679c\u6267\u884c\u7528\u6237\u62e5\u6709\u5408\u9002\u7684\u6743\u9650\uff0c\u90a3\u4e48\u4ed6\u53ef\u4ee5\u901a\u8fc7 -O\u6307\u5b9a\u5408\u9002\u7684\u7528\u6237\u3002createdb\u662f\u4e00\u4e2aSQL\u547d\u4ee4 CREATE DATABASE\u7684\u5c01\u88c5\u3002 <\/p>\n\n\n\n

\u8bed\u6cd5\u683c\u5f0f\uff1a<\/strong>createdb [\u53c2\u6570] [\u6570\u636e\u5e93] [\u63cf\u8ff0]<\/p>\n\n\n\n

\u5e38\u7528\u53c2\u6570\uff1a<\/strong><\/p>\n\n\n\n

-D<\u8868\u7a7a\u95f4><\/td>\u6570\u636e\u5e93\u9ed8\u8ba4\u8868\u7a7a\u95f4<\/td><\/tr>
-e<\/td>\u663e\u793a\u53d1\u9001\u5230\u670d\u52a1\u7aef\u7684\u547d\u4ee4<\/td><\/tr>
-O<\u6240\u6709\u8005><\/td>\u65b0\u6570\u636e\u5e93\u7684\u6240\u5c5e\u7528\u6237<\/td><\/tr>
-E<\u7f16\u7801><\/td>\u6307\u5b9a\u6570\u636e\u5e93\u7f16\u7801<\/td><\/tr>
-h<\u4e3b\u673a\u540d><\/td>\u6570\u636e\u5e93\u670d\u52a1\u5668\u7684\u4e3b\u673a\u540d<\/td><\/tr>
-p<\u7aef\u53e3><\/td>\u6570\u636e\u5e93\u670d\u52a1\u5668\u7aef\u53e3\u53f7<\/td><\/tr>
-U<\u7528\u6237><\/td>\u8fde\u63a5\u7684\u7528\u6237\u540d<\/td><\/tr>
-w<\/td>\u6c38\u8fdc\u4e0d\u63d0\u793a\u8f93\u5165\u53e3\u4ee4<\/td><\/tr>
-W<\/td>\u5f3a\u5236\u63d0\u793a\u8f93\u5165\u53e3\u4ee4<\/td><\/tr>
-T<\u6a21\u7248\u6570\u636e\u5e93><\/td>\u6307\u5b9a\u8981\u590d\u5236\u7684\u6570\u636e\u5e93\u6a21\u7248<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n

\u53c2\u8003\u5b9e\u4f8b<\/strong><\/p>\n\n\n\n

\u521b\u5efa\u6570\u636e\u5e93linuxcool\uff1a<\/p>\n\n\n\n

[root@linuxcool ~]# su -postgres\n$ createdb  linuxcool<\/pre>\n\n\n\n

\u4e3b\u673a192.168.60.163\u4e0a\u7684\u670d\u52a1\u5668\u521b\u5efa\u6570\u636e\u5e93linuxcool,\u7aef\u53e3\u662f5888\uff1a<\/p>\n\n\n\n

[root@linuxcool ~]# createdb -p 5888 -h 192.168.60.163 linuxcool<\/pre>\n\n\n\n

\u4ee5\u6570\u636e\u5e93linuxcool\u4e3a\u6a21\u7248\u590d\u5236\u521b\u5efa\u6570\u636e\u5e93db1\uff1a<\/p>\n\n\n\n

[root@linuxcool ~]# su -postgres\n$ createdb db1 -T linuxcool<\/pre>\n","protected":false},"excerpt":{"rendered":"

createdb\u547d\u4ee4\u7684\u4f5c\u7528\u662f\u53ef\u4ee5\u521b\u5efa\u4e00\u4e2aPostgreSQL\u6570\u636e\u5e93\u3002 PostgreSQL\u662f\u4e00\u4e2a\u529f\u80fd\u975e\u5e38\u5f3a\u5927\u7684 […]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[1],"tags":[],"_links":{"self":[{"href":"https:\/\/www.linuxcool.com\/wp-json\/wp\/v2\/posts\/8691"}],"collection":[{"href":"https:\/\/www.linuxcool.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.linuxcool.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.linuxcool.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.linuxcool.com\/wp-json\/wp\/v2\/comments?post=8691"}],"version-history":[{"count":4,"href":"https:\/\/www.linuxcool.com\/wp-json\/wp\/v2\/posts\/8691\/revisions"}],"predecessor-version":[{"id":8709,"href":"https:\/\/www.linuxcool.com\/wp-json\/wp\/v2\/posts\/8691\/revisions\/8709"}],"wp:attachment":[{"href":"https:\/\/www.linuxcool.com\/wp-json\/wp\/v2\/media?parent=8691"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.linuxcool.com\/wp-json\/wp\/v2\/categories?post=8691"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.linuxcool.com\/wp-json\/wp\/v2\/tags?post=8691"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}