{"id":5162,"date":"2021-02-20T15:47:55","date_gmt":"2021-02-20T07:47:55","guid":{"rendered":"https:\/\/www.xttblog.com\/?p=5162"},"modified":"2021-02-20T15:53:52","modified_gmt":"2021-02-20T07:53:52","slug":"%e8%a7%a3%e5%86%b3org-postgresql-util-psqlexception-error-permission-denied-for-table-xxx%e5%bc%82%e5%b8%b8","status":"publish","type":"post","link":"https:\/\/www.xttblog.com\/?p=5162","title":{"rendered":"\u89e3\u51b3org.postgresql.util.PSQLException: ERROR: permission denied for table xxx\u5f02\u5e38"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">\u6700\u8fd1\u4e00\u4e2a\u53f7\u79f0\u8001\u53f8\u673a\u7684\u817e\u8baf\u8fd0\u7ef4\u5e08\u5085\u5b89\u88c5\u4e86\u4e00\u4e2a PostgreSQL \u6570\u636e\u5e93\uff0c\u5728\u90e8\u7f72\u90e8\u5206\u5e94\u7528\u540e\u63d0\u793a\uff1aorg.postgresql.util.PSQLException: ERROR: permission denied for table tx_user \u5f02\u5e38\u3002<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u8fd9\u4e2a\u8fd0\u7ef4\u5e08\u5085\u592a\u61d2\uff0c\u5f02\u5e38\u65e5\u5fd7\u4e5f\u4e0d\u770b\uff0c\u76f4\u63a5\u53d1\u7ed9\u6211\u3002\u6211\u4e00\u770b\uff0c\u5c31\u53d1\u73b0\u662f PostgreSQL \u6570\u636e\u5e93\u7684\u6743\u9650\u8bbe\u7f6e\u7684\u4e0d\u5bf9\u3002<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u8fd9\u4e2a ERROR \u7684\u5927\u81f4\u610f\u601d\u662f\u8bf4\uff1a\u8bbf\u95ee\u8868 tx_user \u7684\u6743\u9650\u88ab\u62d2\u7edd\u3002<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u65e2\u7136\u662f\u6743\u9650\u95ee\u9898\uff0c\u90a3\u5c31\u6267\u884c\u4e00\u4e0b\u4e0b\u9762\u7684\u547d\u4ee4\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>grant all privileges on database xxx to xxx<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">\u8fd0\u7ef4\u6267\u884c\u8fc7\u540e\uff0c\u91cd\u542f\u5e94\u7528\u53d1\u73b0\u8fd8\u662f\u4e0d\u884c\u3002<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u4e8e\u662f\u53c8\u53d1\u7ed9\u4ed6\u4e00\u6761\u547d\u4ee4\uff0c\u6267\u884c\u4e0b\u9762\u7684\u8bed\u53e5\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>GRANT SELECT ON ALL TABLES IN SCHEMA public TO myuser;<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">\u4e0d\u9650\u9ebb\u70e6\u7684\u53ef\u4ee5\u6267\u884c\u4e0b\u9762\u7684\u8bed\u53e5\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>psql -U postgres -d postgres\n -- \u5207\u6362\u5230mydb\u6570\u636e\u5e93\n \\c mydb\n -- \u8d4b\u4e88\u6240\u6709\u8868\u7684\u6240\u6709\u6743\u9650\u7ed9xttblog\n GRANT ALL PRIVILEGES ON ALL TABLES IN SCHEMA public TO xttblog; \n \/\/ \u8d4b\u4e88codedq\u7528\u6237\uff0ctuser\u8868\u7684\u6240\u6709\u6743\u9650\n GRANT ALL PRIVILEGES ON tuser TO codedq; <\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">\u6700\u7ec8\uff0c\u5b8c\u7f8e\u89e3\u51b3\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">\u53c2\u8003\u8d44\u6599<\/h2>\n\n\n\n<ul class=\"wp-block-list\"><li><a rel=\"noreferrer noopener\" aria-label=\"https:\/\/stackoverflow.com\/questions\/22595560\/postgresql-permission-denied-for-relation\uff08\u5728\u65b0\u7a97\u53e3\u6253\u5f00\uff09\" href=\"https:\/\/stackoverflow.com\/questions\/22595560\/postgresql-permission-denied-for-relation\" target=\"_blank\">https:\/\/stackoverflow.com\/questions\/22595560\/postgresql-permission-denied-for-relation<\/a><\/li><li><a href=\"https:\/\/stackoverflow.com\/questions\/10491208\/how-to-grant-all-privileges-on-views-to-arbitrary-user\/10491275\" target=\"_blank\" rel=\"noreferrer noopener\" aria-label=\"https:\/\/stackoverflow.com\/questions\/10491208\/how-to-grant-all-privileges-on-views-to-arbitrary-user\/10491275\uff08\u5728\u65b0\u7a97\u53e3\u6253\u5f00\uff09\">https:\/\/stackoverflow.com\/questions\/10491208\/how-to-grant-all-privileges-on-views-to-arbitrary-user\/10491275<\/a><\/li><\/ul>\n<!-- <audio autoplay=\"autoplay\" height=\"100\" width=\"100\" hidden=\"true\"><source src=\"https:\/\/c.coka.la\/orAvPR.mp3\" type=\"audio\/mp3\"\/><\/audio><img decoding=\"async\" src=\"https:\/\/images.weserv.nl\/?url=https:\/\/ws3.sinaimg.cn\/large\/8fa5dcfcgy1g4em3rzar5j20ib089ae0.jpg\" alt=\"\u4e1a\u4f59\u8349\u516c\u4f17\u53f7\"\/> --><p><!-- <img decoding=\"async\" src=\"https:\/\/raw.githubusercontent.com\/xmt1139057136\/xttblog\/master\/8fa5dcfcgy1g4em3rzar5j20ib089ae0.jpg\" alt=\"\u4e1a\u4f59\u8349\u516c\u4f17\u53f7\"\/>--><img decoding=\"async\" src=\"https:\/\/saas.51autoparts.cn\/api\/admin\/sys-file\/oss\/file?fileName=84db51f8561e448f9a4fda2eff0811f9.jpg\" alt=\"\u4e1a\u4f59\u8349\u516c\u4f17\u53f7\"\/><\/p><p>\u6700\u540e\uff0c\u6b22\u8fce\u5173\u6ce8\u6211\u7684\u4e2a\u4eba\u5fae\u4fe1\u516c\u4f17\u53f7\uff1a\u4e1a\u4f59\u8349\uff08yyucao\uff09\uff01<b>\u53ef\u52a0\u4f5c\u8005\u5fae\u4fe1\u53f7\uff1a<font color=\"red\">xttblog2<\/font>\u3002\u5907\u6ce8\uff1a\u201c1\u201d\uff0c\u6dfb\u52a0\u535a\u4e3b\u5fae\u4fe1\u62c9\u4f60\u8fdb\u5fae\u4fe1\u7fa4\u3002\u5907\u6ce8\u9519\u8bef\u4e0d\u4f1a\u540c\u610f\u597d\u53cb\u7533\u8bf7\u3002<\/b>\u518d\u6b21\u611f\u8c22\u60a8\u7684\u5173\u6ce8\uff01\u540e\u7eed\u6709\u7cbe\u5f69\u5185\u5bb9\u4f1a\u7b2c\u4e00\u65f6\u95f4\u53d1\u7ed9\u60a8\uff01\u539f\u521b\u6587\u7ae0\u6295\u7a3f\u8bf7\u53d1\u9001\u81f3532009913@qq.com\u90ae\u7bb1\u3002\u5546\u52a1\u5408\u4f5c\u4e5f\u53ef\u6dfb\u52a0\u4f5c\u8005\u5fae\u4fe1\u8fdb\u884c\u8054\u7cfb\uff01<\/p><p>\u672c\u6587\u539f\u6587\u51fa\u5904\uff1a<a href=\"https:\/\/www.xttblog.com\">\u4e1a\u4f59\u8349<\/a>\uff1a &raquo; <a href=\"https:\/\/www.xttblog.com\/?p=5162\">\u89e3\u51b3org.postgresql.util.PSQLException: ERROR: permission denied for table xxx\u5f02\u5e38<\/a><\/p><!-- <div class=\"bd-reward-stl\"><button id=\"bdRewardBtn\"><span><\/span><\/button><\/div> -->","protected":false},"excerpt":{"rendered":"<p>\u6700\u8fd1\u4e00\u4e2a\u53f7\u79f0\u8001\u53f8\u673a\u7684\u817e\u8baf\u8fd0\u7ef4\u5e08\u5085\u5b89\u88c5\u4e86\u4e00\u4e2a PostgreSQL \u6570\u636e\u5e93\uff0c\u5728\u90e8\u7f72\u90e8\u5206\u5e94\u7528\u540e\u63d0\u793a\uff1aorg.pos [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[12],"tags":[428,429,157,681,906],"class_list":["post-5162","post","type-post","status-publish","format-standard","hentry","category-sql","tag-greenplum","tag-postgresql","tag-sql","tag-681","tag-906"],"_links":{"self":[{"href":"https:\/\/www.xttblog.com\/index.php?rest_route=\/wp\/v2\/posts\/5162","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.xttblog.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.xttblog.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.xttblog.com\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.xttblog.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=5162"}],"version-history":[{"count":2,"href":"https:\/\/www.xttblog.com\/index.php?rest_route=\/wp\/v2\/posts\/5162\/revisions"}],"predecessor-version":[{"id":5164,"href":"https:\/\/www.xttblog.com\/index.php?rest_route=\/wp\/v2\/posts\/5162\/revisions\/5164"}],"wp:attachment":[{"href":"https:\/\/www.xttblog.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=5162"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.xttblog.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=5162"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.xttblog.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=5162"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}