{"id":289,"date":"2023-11-28T19:17:27","date_gmt":"2023-11-28T19:17:27","guid":{"rendered":"http:\/\/77interactive.com\/?p=289"},"modified":"2023-11-28T19:17:41","modified_gmt":"2023-11-28T19:17:41","slug":"create-postgresql-user-with-all-database-privileges","status":"publish","type":"post","link":"http:\/\/77interactive.com\/?p=289","title":{"rendered":"Create PostgreSQL user with all database privileges"},"content":{"rendered":"\n<p>The following script creates a new user named user002. The user will have all rights on a particular database named Tex01. The script will include the public schema and the tex002 schema. <\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>-- Step 1: Create the User\r\nCREATE USER user002 WITH PASSWORD 'your_password';\r\n\r\n-- Step 2: Grant Privileges in the Tex01 Database\r\n\\c Tex01\r\n\r\n-- Grant all privileges on the public schema\r\nGRANT ALL PRIVILEGES ON SCHEMA public TO user002;\r\n\r\n-- Grant all privileges on the tex002 schema\r\nGRANT ALL PRIVILEGES ON SCHEMA tex002 TO user002;\r\n\r\n-- Grant all privileges on all tables in the public schema\r\nGRANT ALL PRIVILEGES ON ALL TABLES IN SCHEMA public TO user002;\r\n\r\n-- Grant all privileges on all sequences in the public schema\r\nGRANT ALL PRIVILEGES ON ALL SEQUENCES IN SCHEMA public TO user002;\r\n\r\n-- Grant all privileges on all functions in the public schema\r\nGRANT ALL PRIVILEGES ON ALL FUNCTIONS IN SCHEMA public TO user002;\r\n\r\n-- Similarly, grant privileges on all objects in the tex002 schema\r\nGRANT ALL PRIVILEGES ON ALL TABLES IN SCHEMA tex002 TO user002;\r\nGRANT ALL PRIVILEGES ON ALL SEQUENCES IN SCHEMA tex002 TO user002;\r\nGRANT ALL PRIVILEGES ON ALL FUNCTIONS IN SCHEMA tex002 TO user002;\r\n\r\n-- Optional: Grant connect privilege to the Tex01 database\r\nGRANT CONNECT ON DATABASE Tex01 TO user002;\r\n<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Create a new user in PostgreSQL<\/p>\n","protected":false},"author":1,"featured_media":290,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[21],"tags":[44,17,18,45],"class_list":["post-289","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-postgres","tag-permissions","tag-postgres","tag-postgresql","tag-security"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v26.9 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Create PostgreSQL user with all database privileges - 77 Interactive<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"http:\/\/77interactive.com\/?p=289\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Create PostgreSQL user with all database privileges - 77 Interactive\" \/>\n<meta property=\"og:description\" content=\"Create a new user in PostgreSQL\" \/>\n<meta property=\"og:url\" content=\"http:\/\/77interactive.com\/?p=289\" \/>\n<meta property=\"og:site_name\" content=\"77 Interactive\" \/>\n<meta property=\"article:published_time\" content=\"2023-11-28T19:17:27+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2023-11-28T19:17:41+00:00\" \/>\n<meta property=\"og:image\" content=\"http:\/\/77interactive.com\/wp-content\/uploads\/2023\/11\/cartoon_elephant.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"1080\" \/>\n\t<meta property=\"og:image:height\" content=\"1080\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"Rudy\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Rudy\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"1 minute\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"http:\/\/77interactive.com\/?p=289#article\",\"isPartOf\":{\"@id\":\"http:\/\/77interactive.com\/?p=289\"},\"author\":{\"name\":\"Rudy\",\"@id\":\"http:\/\/77interactive.com\/#\/schema\/person\/0e61d2a984b8304618026b207e6121e9\"},\"headline\":\"Create PostgreSQL user with all database privileges\",\"datePublished\":\"2023-11-28T19:17:27+00:00\",\"dateModified\":\"2023-11-28T19:17:41+00:00\",\"mainEntityOfPage\":{\"@id\":\"http:\/\/77interactive.com\/?p=289\"},\"wordCount\":39,\"image\":{\"@id\":\"http:\/\/77interactive.com\/?p=289#primaryimage\"},\"thumbnailUrl\":\"http:\/\/77interactive.com\/wp-content\/uploads\/2023\/11\/cartoon_elephant.jpg\",\"keywords\":[\"permissions\",\"postgres\",\"postgresql\",\"security\"],\"articleSection\":[\"postgres\"],\"inLanguage\":\"en-US\"},{\"@type\":\"WebPage\",\"@id\":\"http:\/\/77interactive.com\/?p=289\",\"url\":\"http:\/\/77interactive.com\/?p=289\",\"name\":\"Create PostgreSQL user with all database privileges - 77 Interactive\",\"isPartOf\":{\"@id\":\"http:\/\/77interactive.com\/#website\"},\"primaryImageOfPage\":{\"@id\":\"http:\/\/77interactive.com\/?p=289#primaryimage\"},\"image\":{\"@id\":\"http:\/\/77interactive.com\/?p=289#primaryimage\"},\"thumbnailUrl\":\"http:\/\/77interactive.com\/wp-content\/uploads\/2023\/11\/cartoon_elephant.jpg\",\"datePublished\":\"2023-11-28T19:17:27+00:00\",\"dateModified\":\"2023-11-28T19:17:41+00:00\",\"author\":{\"@id\":\"http:\/\/77interactive.com\/#\/schema\/person\/0e61d2a984b8304618026b207e6121e9\"},\"breadcrumb\":{\"@id\":\"http:\/\/77interactive.com\/?p=289#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"http:\/\/77interactive.com\/?p=289\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"http:\/\/77interactive.com\/?p=289#primaryimage\",\"url\":\"http:\/\/77interactive.com\/wp-content\/uploads\/2023\/11\/cartoon_elephant.jpg\",\"contentUrl\":\"http:\/\/77interactive.com\/wp-content\/uploads\/2023\/11\/cartoon_elephant.jpg\",\"width\":1080,\"height\":1080},{\"@type\":\"BreadcrumbList\",\"@id\":\"http:\/\/77interactive.com\/?p=289#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"http:\/\/77interactive.com\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Create PostgreSQL user with all database privileges\"}]},{\"@type\":\"WebSite\",\"@id\":\"http:\/\/77interactive.com\/#website\",\"url\":\"http:\/\/77interactive.com\/\",\"name\":\"77 Interactive\",\"description\":\"Rudy&#039;s Code snippets\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"http:\/\/77interactive.com\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"http:\/\/77interactive.com\/#\/schema\/person\/0e61d2a984b8304618026b207e6121e9\",\"name\":\"Rudy\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"http:\/\/77interactive.com\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/e336b9aecd39b40691ff8ccfcd68506415072dbe8caffc0485b94a1bc22b774d?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/e336b9aecd39b40691ff8ccfcd68506415072dbe8caffc0485b94a1bc22b774d?s=96&d=mm&r=g\",\"caption\":\"Rudy\"},\"url\":\"http:\/\/77interactive.com\/?author=1\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Create PostgreSQL user with all database privileges - 77 Interactive","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"http:\/\/77interactive.com\/?p=289","og_locale":"en_US","og_type":"article","og_title":"Create PostgreSQL user with all database privileges - 77 Interactive","og_description":"Create a new user in PostgreSQL","og_url":"http:\/\/77interactive.com\/?p=289","og_site_name":"77 Interactive","article_published_time":"2023-11-28T19:17:27+00:00","article_modified_time":"2023-11-28T19:17:41+00:00","og_image":[{"width":1080,"height":1080,"url":"http:\/\/77interactive.com\/wp-content\/uploads\/2023\/11\/cartoon_elephant.jpg","type":"image\/jpeg"}],"author":"Rudy","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Rudy","Est. reading time":"1 minute"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"http:\/\/77interactive.com\/?p=289#article","isPartOf":{"@id":"http:\/\/77interactive.com\/?p=289"},"author":{"name":"Rudy","@id":"http:\/\/77interactive.com\/#\/schema\/person\/0e61d2a984b8304618026b207e6121e9"},"headline":"Create PostgreSQL user with all database privileges","datePublished":"2023-11-28T19:17:27+00:00","dateModified":"2023-11-28T19:17:41+00:00","mainEntityOfPage":{"@id":"http:\/\/77interactive.com\/?p=289"},"wordCount":39,"image":{"@id":"http:\/\/77interactive.com\/?p=289#primaryimage"},"thumbnailUrl":"http:\/\/77interactive.com\/wp-content\/uploads\/2023\/11\/cartoon_elephant.jpg","keywords":["permissions","postgres","postgresql","security"],"articleSection":["postgres"],"inLanguage":"en-US"},{"@type":"WebPage","@id":"http:\/\/77interactive.com\/?p=289","url":"http:\/\/77interactive.com\/?p=289","name":"Create PostgreSQL user with all database privileges - 77 Interactive","isPartOf":{"@id":"http:\/\/77interactive.com\/#website"},"primaryImageOfPage":{"@id":"http:\/\/77interactive.com\/?p=289#primaryimage"},"image":{"@id":"http:\/\/77interactive.com\/?p=289#primaryimage"},"thumbnailUrl":"http:\/\/77interactive.com\/wp-content\/uploads\/2023\/11\/cartoon_elephant.jpg","datePublished":"2023-11-28T19:17:27+00:00","dateModified":"2023-11-28T19:17:41+00:00","author":{"@id":"http:\/\/77interactive.com\/#\/schema\/person\/0e61d2a984b8304618026b207e6121e9"},"breadcrumb":{"@id":"http:\/\/77interactive.com\/?p=289#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["http:\/\/77interactive.com\/?p=289"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"http:\/\/77interactive.com\/?p=289#primaryimage","url":"http:\/\/77interactive.com\/wp-content\/uploads\/2023\/11\/cartoon_elephant.jpg","contentUrl":"http:\/\/77interactive.com\/wp-content\/uploads\/2023\/11\/cartoon_elephant.jpg","width":1080,"height":1080},{"@type":"BreadcrumbList","@id":"http:\/\/77interactive.com\/?p=289#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"http:\/\/77interactive.com\/"},{"@type":"ListItem","position":2,"name":"Create PostgreSQL user with all database privileges"}]},{"@type":"WebSite","@id":"http:\/\/77interactive.com\/#website","url":"http:\/\/77interactive.com\/","name":"77 Interactive","description":"Rudy&#039;s Code snippets","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"http:\/\/77interactive.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"http:\/\/77interactive.com\/#\/schema\/person\/0e61d2a984b8304618026b207e6121e9","name":"Rudy","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"http:\/\/77interactive.com\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/e336b9aecd39b40691ff8ccfcd68506415072dbe8caffc0485b94a1bc22b774d?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/e336b9aecd39b40691ff8ccfcd68506415072dbe8caffc0485b94a1bc22b774d?s=96&d=mm&r=g","caption":"Rudy"},"url":"http:\/\/77interactive.com\/?author=1"}]}},"_links":{"self":[{"href":"http:\/\/77interactive.com\/index.php?rest_route=\/wp\/v2\/posts\/289","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/77interactive.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/77interactive.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/77interactive.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/77interactive.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=289"}],"version-history":[{"count":0,"href":"http:\/\/77interactive.com\/index.php?rest_route=\/wp\/v2\/posts\/289\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"http:\/\/77interactive.com\/index.php?rest_route=\/wp\/v2\/media\/290"}],"wp:attachment":[{"href":"http:\/\/77interactive.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=289"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/77interactive.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=289"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/77interactive.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=289"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}