{"id":257,"date":"2018-11-14T11:35:39","date_gmt":"2018-11-14T08:35:39","guid":{"rendered":"https:\/\/artem.services\/?p=257"},"modified":"2019-04-15T14:34:57","modified_gmt":"2019-04-15T11:34:57","slug":"postgres-%d0%be%d1%81%d0%bd%d0%be%d0%b2%d0%bd%d1%8b%d0%b5-%d0%ba%d0%be%d0%bc%d0%b0%d0%bd%d0%b4%d1%8b","status":"publish","type":"post","link":"https:\/\/artem.services\/?p=257","title":{"rendered":"Postgres &#8212; \u041e\u0441\u043d\u043e\u0432\u043d\u044b\u0435 \u043a\u043e\u043c\u0430\u043d\u0434\u044b"},"content":{"rendered":"<p>\u041b\u043e\u0433\u0438\u043d\u0438\u043c\u0441\u044f \u043a\u0430\u043a \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c <strong>postgres<\/strong>:<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\nsu postgres\r\n<\/pre>\n<p>\u0421\u043f\u0438\u0441\u043e\u043a \u0431\u0430\u0437 \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u043d\u0435 \u0437\u0430\u0445\u043e\u0434\u044f \u0432<strong> psql<\/strong>:<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\npsql -l\r\n<\/pre>\n<p>\u0417\u0430\u0445\u043e\u0434\u0438\u043c \u0432 <strong>psql<\/strong>:<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\npsql\r\n<\/pre>\n<p>\u0421\u043e\u0437\u0434\u0430\u0442\u044c \u0431\u0430\u0437\u0443 \u0434\u0430\u043d\u043d\u044b\u0445, \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f \u0438 \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u0435\u043c\u0443 \u043f\u043e\u043b\u043d\u044b\u0439 \u0434\u043e\u0441\u0442\u0443\u043f \u043a \u0431\u0430\u0437\u0435:<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\nCREATE DATABASE database_name;\r\nCREATE USER user_name WITH password 'user_password';\r\nGRANT ALL privileges ON DATABASE database_name TO user_name;\r\n<\/pre>\n<p>\u0421\u043e\u0437\u0434\u0430\u0442\u044c \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f \u0438 \u0431\u0430\u0437\u0443 \u0434\u0430\u043d\u043d\u044b\u0445, \u0432\u043b\u0430\u0434\u0435\u043b\u044c\u0446\u0435\u043c \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u0431\u0443\u0434\u0435\u0442 \u044f\u0432\u043b\u044f\u0442\u044c\u0441\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u043d\u044b\u0439 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c:<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\nCREATE USER user_name WITH password 'user_password';\r\nCREATE DATABASE database_name OWNER user_name;\r\n<\/pre>\n<p>\u0418\u0437\u043c\u0435\u043d\u0438\u0442\u044c \u0432\u043b\u0430\u0434\u0435\u043b\u044c\u0446\u0430 \u0431\u0430\u0437\u044b \u0434\u0430\u043d\u043d\u044b\u0445:<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\nALTER DATABASE database_name OWNER TO new_owner;\r\n<\/pre>\n<p>\u0423\u0434\u0430\u043b\u0438\u0442\u044c \u0432\u0441\u0435 \u043f\u0440\u0430\u0432\u0430 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f \u043d\u0430 \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u0443\u044e \u0431\u0430\u0437\u0443:<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\nREVOKE ALL PRIVILEGES ON DATABASE &quot;database_name&quot; from user_name;\r\n<\/pre>\n<p>\u0414\u0435\u043b\u0430\u0435\u043c \u0434\u0430\u043c\u043f \u0431\u0430\u0437\u044b:<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\npg_dump -d db_name -U user_name -W -h localhost &gt; db_name.sql\r\n<\/pre>\n<p>\u0417\u0430\u043b\u0438\u0432\u0430\u0435\u043c \u0434\u0430\u043c\u043f:<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\npsql -h localhost -U user_name -b db_name &lt; db_name.sql\r\n<\/pre>\n<p>\u041f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 \u043a AWS RDS Postgres:<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\npsql -U artem -h artem-db.xxxxxxxxxxxx.eu-west-1.rds.amazonaws.com postgres\r\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>\u041b\u043e\u0433\u0438\u043d\u0438\u043c\u0441\u044f \u043a\u0430\u043a \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c postgres: \u0421\u043f\u0438\u0441\u043e\u043a \u0431\u0430\u0437 \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u043d\u0435 \u0437\u0430\u0445\u043e\u0434\u044f \u0432 psql: \u0417\u0430\u0445\u043e\u0434\u0438\u043c \u0432 psql: \u0421\u043e\u0437\u0434\u0430\u0442\u044c \u0431\u0430\u0437\u0443 \u0434\u0430\u043d\u043d\u044b\u0445, \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f \u0438 \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u0435\u043c\u0443 \u043f\u043e\u043b\u043d\u044b\u0439 \u0434\u043e\u0441\u0442\u0443\u043f \u043a \u0431\u0430\u0437\u0435: \u0421\u043e\u0437\u0434\u0430\u0442\u044c \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f \u0438 \u0431\u0430\u0437\u0443 \u0434\u0430\u043d\u043d\u044b\u0445, \u0432\u043b\u0430\u0434\u0435\u043b\u044c\u0446\u0435\u043c \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u0431\u0443\u0434\u0435\u0442 \u044f\u0432\u043b\u044f\u0442\u044c\u0441\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u043d\u044b\u0439 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c: \u0418\u0437\u043c\u0435\u043d\u0438\u0442\u044c \u0432\u043b\u0430\u0434\u0435\u043b\u044c\u0446\u0430 \u0431\u0430\u0437\u044b \u0434\u0430\u043d\u043d\u044b\u0445: \u0423\u0434\u0430\u043b\u0438\u0442\u044c \u0432\u0441\u0435 \u043f\u0440\u0430\u0432\u0430 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f \u043d\u0430 \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u0443\u044e \u0431\u0430\u0437\u0443: \u0414\u0435\u043b\u0430\u0435\u043c \u0434\u0430\u043c\u043f \u0431\u0430\u0437\u044b: \u0417\u0430\u043b\u0438\u0432\u0430\u0435\u043c \u0434\u0430\u043c\u043f: \u041f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 \u043a &hellip; <a href=\"https:\/\/artem.services\/?p=257\" class=\"more-link\">\u041f\u0440\u043e\u0434\u043e\u043b\u0436\u0438\u0442\u044c \u0447\u0438\u0442\u0430\u0442\u044c<span class=\"screen-reader-text\"> &quot;Postgres &#8212; \u041e\u0441\u043d\u043e\u0432\u043d\u044b\u0435 \u043a\u043e\u043c\u0430\u043d\u0434\u044b&quot;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[45],"tags":[46,47,48],"_links":{"self":[{"href":"https:\/\/artem.services\/index.php?rest_route=\/wp\/v2\/posts\/257"}],"collection":[{"href":"https:\/\/artem.services\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/artem.services\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/artem.services\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/artem.services\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=257"}],"version-history":[{"count":3,"href":"https:\/\/artem.services\/index.php?rest_route=\/wp\/v2\/posts\/257\/revisions"}],"predecessor-version":[{"id":1008,"href":"https:\/\/artem.services\/index.php?rest_route=\/wp\/v2\/posts\/257\/revisions\/1008"}],"wp:attachment":[{"href":"https:\/\/artem.services\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=257"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/artem.services\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=257"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/artem.services\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=257"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}