{"id":12230,"date":"2013-01-06T21:00:01","date_gmt":"2013-01-06T12:00:01","guid":{"rendered":"http:\/\/www.sssg.org\/blogs\/hiro345\/?p=12230"},"modified":"2013-01-08T14:51:38","modified_gmt":"2013-01-08T05:51:38","slug":"postgresql%e3%81%ae%e4%bd%bf%e3%81%84%e5%a7%8b%e3%82%81","status":"publish","type":"post","link":"https:\/\/www.hiro345.net\/blogs\/hiro345\/archives\/12230.html","title":{"rendered":"PostgreSQL\u306e\u4f7f\u3044\u59cb\u3081"},"content":{"rendered":"<p>\u4e45\u3057\u3076\u308a\u306bPostgreSQL\u3092\u4f7f\u3046\u3053\u3068\u306b\u3057\u305f\u306e\u3067\u3001\u3061\u3087\u3063\u3068\u78ba\u8a8d<br \/>\n<!--more--><br \/>\nCentOS\u3067\u306f\u3001postgresql, postgresql-server\u3092\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3059\u308c\u3070\u826f\u3044\u3067\u3059\u306d\u3002\u521d\u3081\u3066\u8d77\u52d5\u3059\u308b\u3068\u304d\u306f\u3001initdb\u3092\u3057\u3066\u304b\u3089\u3001start\u3057\u307e\u3059\u3002\u3069\u3061\u3089\u3082service\u30b3\u30de\u30f3\u30c9\u304b\u3089\u5b9f\u884c\u3067\u3059\u3002\u3053\u3053\u3067\u306f\u3084\u3063\u3066\u3044\u307e\u305b\u3093\u304c\u3001\u81ea\u52d5\u8d77\u52d5\u3092\u3057\u305f\u3044\u5834\u5408\u306fchkconfig\u3067postgresql\u3092on\u306b\u3059\u308b\u5fc5\u8981\u304c\u3042\u308a\u307e\u3059\u3002<\/p>\n<pre class=\"brush: bash; gutter: true\">\r\n$ sudo yum install postgresql postgresql-server\r\n$ sudo service postgresql initdb\r\n$ sudo service postgresql start\r\n<\/pre>\n<p>DB\u3092\u4f5c\u308b\u306b\u306fpostgres\u30e6\u30fc\u30b6\u306b\u306a\u308a\u307e\u3059\u3002\u3053\u3053\u3067\u306fuser001\u3068\u3044\u3046\u30e6\u30fc\u30b6\u3092\u4f5c\u6210\u3057\u3066\u3044\u307e\u3059\u3002Linux\u306e\u30a2\u30ab\u30a6\u30f3\u30c8\u3068\u540c\u3058\u540d\u524d\u306b\u3057\u3066\u3044\u307e\u3059\uff08sudo su &#8211; \u306e\u30b3\u30de\u30f3\u30c9\u3092\u5b9f\u884c\u3059\u308b\u30e6\u30fc\u30b6\u3068\u540c\u3058\uff09\u3002\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u4f5c\u6210\u306e\u6a29\u9650\u3092\u4ed8\u4e0e\u3057\u3066\u3044\u307e\u3059\u3002psql -l \u3067\u73fe\u5728\u306e\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u4e00\u89a7\u3092\u78ba\u8a8d\u3057\u3066\u304b\u3089\u30e6\u30fc\u30b6\u306e\u4f5c\u6210\u3092\u3057\u3066\u3044\u307e\u3059\u3002<\/p>\n<pre class=\"brush: bash; gutter: true\">\r\n$ sudo su - postgres\r\n-bash-4.1$ psql -l\r\n-bash-4.1$ createuser user001\r\n\u65b0\u3057\u3044\u30ed\u30fc\u30eb\u3092\u30b9\u30fc\u30d1\u30fc\u30e6\u30fc\u30b6\u3068\u3057\u307e\u3059\u304b?  (y\/n)n\r\n\u65b0\u3057\u3044\u30ed\u30fc\u30eb\u306b\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u4f5c\u6210\u6a29\u9650\u3092\u4e0e\u3048\u307e\u3059\u304b? (y\/n)y\r\n\u65b0\u3057\u3044\u30ed\u30fc\u30eb\u306b\u30ed\u30fc\u30eb\u3092\u4f5c\u6210\u3059\u308b\u6a29\u9650\u3092\u4e0e\u3048\u307e\u3059\u304b? (y\/n)n\r\n-bash-4.1$ exit\r\n<\/pre>\n<p>user001\u304c\u30a2\u30af\u30bb\u30b9\u3067\u304d\u308b\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u3068\u3057\u3066dbname\u3068\u3044\u3046\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u3092\u4f5c\u6210\u3057\u307e\u3059\u3002psql -l \u3067dbname\u304c\u3067\u304d\u3066\u3044\u308b\u3053\u3068\u304c\u78ba\u8a8d\u3067\u304d\u307e\u3059\u3002dbname\u3078\u30a2\u30af\u30bb\u30b9\u3059\u308b\u306b\u306fpsql\u30b3\u30de\u30f3\u30c9\u3092\u4f7f\u3044\u307e\u3059\u3002<\/p>\n<pre class=\"brush: bash; gutter: true\">\r\n$ createdb dbname -U user001\r\n$ psql -l\r\n$ psql dbname\r\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>\u4e45\u3057\u3076\u308a\u306bPostgreSQL\u3092\u4f7f\u3046\u3053\u3068\u306b\u3057\u305f\u306e\u3067\u3001\u3061\u3087\u3063\u3068\u78ba\u8a8d<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[6],"tags":[26,1209,798],"class_list":["post-12230","post","type-post","status-publish","format-standard","hentry","category-linux","tag-centos","tag-linux","tag-postgresql"],"_links":{"self":[{"href":"https:\/\/www.hiro345.net\/blogs\/hiro345\/wp-json\/wp\/v2\/posts\/12230","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.hiro345.net\/blogs\/hiro345\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.hiro345.net\/blogs\/hiro345\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.hiro345.net\/blogs\/hiro345\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.hiro345.net\/blogs\/hiro345\/wp-json\/wp\/v2\/comments?post=12230"}],"version-history":[{"count":2,"href":"https:\/\/www.hiro345.net\/blogs\/hiro345\/wp-json\/wp\/v2\/posts\/12230\/revisions"}],"predecessor-version":[{"id":12232,"href":"https:\/\/www.hiro345.net\/blogs\/hiro345\/wp-json\/wp\/v2\/posts\/12230\/revisions\/12232"}],"wp:attachment":[{"href":"https:\/\/www.hiro345.net\/blogs\/hiro345\/wp-json\/wp\/v2\/media?parent=12230"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.hiro345.net\/blogs\/hiro345\/wp-json\/wp\/v2\/categories?post=12230"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.hiro345.net\/blogs\/hiro345\/wp-json\/wp\/v2\/tags?post=12230"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}