{"id":480,"date":"2005-01-16T01:42:00","date_gmt":"2005-01-15T16:42:00","guid":{"rendered":"https:\/\/www.picolix.jp\/blog\/2005\/01\/postgres.html\/"},"modified":"2019-04-02T10:25:08","modified_gmt":"2019-04-02T01:25:08","slug":"postgres","status":"publish","type":"post","link":"https:\/\/www.picolix.jp\/blog\/2005\/01\/postgres.html","title":{"rendered":"Postgres \u30c7\u30fc\u30bf\u30d9\u30fc\u30b9"},"content":{"rendered":"<p>[Postgres 7.4.6]<br \/>7.3\u4ee5\u964d\u3067\u306f\u3001initdb\u30b3\u30de\u30f3\u30c9\u5b9f\u884c\u6642\u306b\u3001initdb &#8211;encoding=EUC_JP &#8211;no-locale<br \/>\u306e\u3088\u3046\u306b&#8211;no-locale\u3092\u4ed8\u3051\u3066\u4f5c\u6210\u3057\u306a\u3044\u3068\u3001\u65e5\u672c\u8a9e\u306e\u30bd\u30fc\u30c8\u51e6\u7406\u3001\u691c\u7d22\u306b\u4e0d\u5177\u5408\u304c\u767a\u751f\u3057\u307e\u3059\u3002<\/p>\n<p><a name='more'><\/a><br \/>\u5f53\u521d\u3001initdb &#8211;encoding=EUC_JP\u3067\u4f5c\u3063\u3066\u4f5c\u6210\u3057\u3066\u3044\u305f\u305f\u3081\u3001\u4e00\u90e8\u306e\u691c\u7d22\u304c\u304a\u304b\u3057\u304b\u3063\u305f\u3002<br \/>(http:\/\/search.picolix.jp\u306e\u696d\u7a2e\u9078\u629e\u3067\u304a\u304b\u3057\u306a\u3053\u3068\u306b\u306a\u3063\u3066\u3044\u305f\u3002)<br \/>\uff24\uff22\u3092\u518d\u4f5c\u6210\u3057\u3066\uff2f\uff2b\u3068\u306a\u308a\u307e\u3057\u305f\u3002<br \/>\u5c1a\u3001&#8211;no-locale\u3092\u4ed8\u3051\u308b\u306e\u3068\u4ed8\u3051\u306a\u3044\u306e\u3067\u306f\u3001postgresql.conf\u4e2d\u306elc_\u95a2\u9023\u304c\u4e0b\u8a18\u306e\u3088\u3046\u306b\u306a\u308b\u3002<br \/>\u3053\u308c\u3089\u3092\u66f8\u304d\u63db\u3048\u3066createdb\u3057\u305f\u3082\u306e\u306f\u3001\uff2f\uff2b\u3067\u3059\u304c\u3001\u3059\u3067\u306b\u3001createdb\u3057\u305f\u3082\u306e\u306f\u3001\u518d\u4f5c\u6210\u304c\u5fc5\u8981\u3067\u3059\u3002<br \/>&#8211;no-locale\u304c\u306a\u3044\u6642<br \/>lc_messages = &#8216;en_US.UTF-8&#8217;<br \/>lc_monetary = &#8216;en_US.UTF-8&#8217;<br \/>lc_numeric = &#8216;en_US.UTF-8&#8217;<br \/>lc_time = &#8216;en_US.UTF-8&#8217;<br \/>&#8211;no-locale\u304c\u3042\u308b\u6642<br \/>lc_messages = &#8216;C&#8217;<br \/>lc_monetary = &#8216;C&#8217;<br \/>lc_numeric = &#8216;C&#8217;<br \/>lc_time = &#8216;C&#8217;<br \/>[\u518d\u4f5c\u6210\u624b\u9806]<br \/>#<br \/>postgres\u30e6\u30fc\u30b6\u3067\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u306e\u30c0\u30f3\u30d7\u3092\u3068\u308b\u3002<br \/>$pg_dump lisa -u > lisa.dmp<br \/>postgres\u3092\u505c\u6b62\u3055\u305b\u308b\u3002<br \/>#\/etc\/init.d\/postgresql stop<br \/>\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u306e\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u30fc\u3092data-old\u306b\u3059\u308b\u3002<br \/>\uff08\u518d\u4f5c\u6210\u306b\u5931\u6557\u3057\u305f\u6642\u306b\u3001data-old\u3092data\u306b\u623b\u305b\u3070\u3044\u3064\u3067\u3082\u5fa9\u65e7\u3067\u304d\u307e\u3059\u3002)<br \/>$cd \/usr\/local\/pgsql\/<br \/>$mv data data-old<br \/>&#8211;encoding=EUC_JP &#8211;no-locale\u30aa\u30d7\u30b7\u30e7\u30f3\u3092\u4ed8\u3051\u3066\u518d\u4f5c\u6210<br \/>$initdb &#8211;encoding=EUC_JP &#8211;no-locale<br \/>\u30c7\u30fc\u30bf\u3079\u30fc\u30b9\u3001\u30e6\u30fc\u30b6\u306e\u4f5c\u6210<br \/>$createdb lisa<br \/>$createuser lisa<br \/>$psql lisa<br \/>\u8a8d\u8a3c\u306f\u3001MD5\u306b\u3066\u884c\u3046\u306e\u3067\u3001encrypted\u3092\u4ed8\u3051\u3066\u30d1\u30b9\u30ef\u30fc\u30c9\u3092\u4f5c\u6210\u3059\u308b\u3002<br \/>>ALTER USER postgres encrypted password &#8216;xxxxxxx&#8217;;<br \/>>ALTER USER lisa encrypted password &#8216;xxxxxxx&#8217;;<br \/>>q<br \/>\u30c0\u30f3\u30d7\u3057\u305f\u30c7\u30fc\u30bf\u306e\u30a4\u30f3\u30dd\u30fc\u30c8<br \/>$psql lisa -U lisa  < lisa.dmp<br \/>\u4ee5\u4e0a\u3001\u30e1\u30e2\u3067\u3057\u305f\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>[Postgres 7.4.6]7.3\u4ee5\u964d\u3067\u306f\u3001initdb\u30b3\u30de\u30f3\u30c9\u5b9f\u884c\u6642\u306b\u3001initdb &#8211;encoding=EUC_JP &#8211;no-locale\u306e\u3088\u3046\u306b&#8211;no-locale\u3092\u4ed8\u3051\u3066\u4f5c &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/www.picolix.jp\/blog\/2005\/01\/postgres.html\" class=\"more-link\"><span class=\"screen-reader-text\">&#8220;Postgres \u30c7\u30fc\u30bf\u30d9\u30fc\u30b9&#8221; \u306e<\/span>\u7d9a\u304d\u3092\u8aad\u3080<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[1],"tags":[6],"_links":{"self":[{"href":"https:\/\/www.picolix.jp\/blog\/wp-json\/wp\/v2\/posts\/480"}],"collection":[{"href":"https:\/\/www.picolix.jp\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.picolix.jp\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.picolix.jp\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.picolix.jp\/blog\/wp-json\/wp\/v2\/comments?post=480"}],"version-history":[{"count":1,"href":"https:\/\/www.picolix.jp\/blog\/wp-json\/wp\/v2\/posts\/480\/revisions"}],"predecessor-version":[{"id":904,"href":"https:\/\/www.picolix.jp\/blog\/wp-json\/wp\/v2\/posts\/480\/revisions\/904"}],"wp:attachment":[{"href":"https:\/\/www.picolix.jp\/blog\/wp-json\/wp\/v2\/media?parent=480"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.picolix.jp\/blog\/wp-json\/wp\/v2\/categories?post=480"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.picolix.jp\/blog\/wp-json\/wp\/v2\/tags?post=480"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}