{"id":10107,"date":"2020-08-18T05:46:31","date_gmt":"2020-08-18T05:46:31","guid":{"rendered":"https:\/\/www.milesweb.in\/hosting-faqs\/?p=10107"},"modified":"2020-08-18T05:46:31","modified_gmt":"2020-08-18T05:46:31","slug":"how-to-change-a-password-for-postgresql","status":"publish","type":"post","link":"https:\/\/www.milesweb.in\/hosting-faqs\/how-to-change-a-password-for-postgresql\/","title":{"rendered":"How to change a password for PostgreSQL on Linux via Command line?"},"content":{"rendered":"<p>PostgreSQL is known for supporting many client authentication methods, so, in this case, we will only be concerned about two : <strong>(i) password<\/strong> and <strong>(ii) md5<\/strong>.<\/p>\n<h2>Prerequisites:<\/h2>\n<p>1) The instruction is specially used for changing a password in PostgreSQL.<\/p>\n<p>2) The instructions are performed by using a MilesWeb Core Managed CentOS 7 server and we are logged in a root.<\/p>\n<p>3) PostgreSQL is already installed.<\/p>\n<h2><strong>Step 1: Switch to the PostgreSQL user: postgres<\/strong><\/h2>\n<p>N case you are working from a default PostgreSQL installation, then PostgreSQL will be configured with the user postgres.<\/p>\n<p>As we are logged in as root, it can be assumed that root doesn\u2019t have a user for PostgreSQL, switch to the default PostgreSQL user: postgres<\/p>\n<pre class=\"trim-whitespace:false lang:default decode:true \">su - postgres<\/pre>\n<p>Now, attempt to connect to PostgreSQL :<\/p>\n<pre class=\"trim-whitespace:false lang:default decode:true \">psql<\/pre>\n<p>At the prompt, enter your password<\/p>\n<pre class=\"trim-whitespace:false lang:default decode:true \">Password:<\/pre>\n<p>The correct and valid response will be similar to :<\/p>\n<pre class=\"trim-whitespace:false lang:default decode:true \">psql (9.3.9)\r\nType \"help\" for help.\r\n\r\npostgres=#<\/pre>\n<h2>Step 2: Add and Change the password for the PostgreSQL user: postgres<\/h2>\n<p>Using the following command you can change the password for your current user, which is now postgres :<\/p>\n<pre class=\"trim-whitespace:false lang:default decode:true \">\\password<\/pre>\n<p>Enter your new password. Re-enter it to confirm.<\/p>\n<pre class=\"trim-whitespace:false lang:default decode:true \">Enter new password:\r\nEnter it again:<\/pre>\n<p>Now quit the PostgreSQL interface using the following command :<\/p>\n<pre class=\"trim-whitespace:false lang:default decode:true \">\\q<\/pre>\n<h2>Tip :<\/h2>\n<p>You can perform all the above-mentioned steps in only one command :<\/p>\n<pre class=\"trim-whitespace:false lang:default decode:true \">su -c \"psql\" - postgres<\/pre>\n<p>That\u2019s it.<\/p>\n<p><strong>Also Read :<\/strong><\/p>\n<p><a href=\"https:\/\/www.milesweb.in\/hosting-faqs\/install-postgresql-on-ubuntu-18-04\/\" target=\"_blank\" rel=\"noopener\"><strong>Learn to Install PostgreSQL on Ubuntu 18.04<\/strong><\/a><\/p>\n<p><a href=\"https:\/\/www.milesweb.in\/hosting-faqs\/how-to-install-chkrootkit-security-scanner-on-ubuntu-18-04\/\" target=\"_blank\" rel=\"noopener\"><strong>How To Install Chkrootkit Security Scanner On<\/strong> <strong>Ubuntu 18.04<\/strong><\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>PostgreSQL is known for supporting many client authentication methods, so, in this case, we will only be concerned about two : (i) password and (ii) md5. Prerequisites: 1) The instruction is specially used for changing a password in PostgreSQL. 2) The instructions are performed by using a MilesWeb Core Managed CentOS 7 server and we [&hellip;]<\/p>\n","protected":false},"author":18,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[41],"tags":[1585,1586,951,1170,1584,1583,1582,1587,1588,1589,1590,637],"class_list":["post-10107","post","type-post","status-publish","format-standard","placeholder-for-hentry","category-howtos","tag-authentication","tag-authentication-method","tag-centos","tag-database","tag-fedora","tag-md5","tag-password","tag-postgres","tag-psql","tag-systemctl","tag-systemd","tag-ubuntu"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.1.1 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>How to change a password for PostgreSQL on Linux via Command line? - Web Hosting FAQs by MilesWeb<\/title>\n<meta name=\"description\" content=\"The knowledgebase explains how to change the password for PostgreSQL on Linux using the command line.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.milesweb.in\/hosting-faqs\/how-to-change-a-password-for-postgresql\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"How to change a password for PostgreSQL on Linux via Command line? - Web Hosting FAQs by MilesWeb\" \/>\n<meta property=\"og:description\" content=\"The knowledgebase explains how to change the password for PostgreSQL on Linux using the command line.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.milesweb.in\/hosting-faqs\/how-to-change-a-password-for-postgresql\/\" \/>\n<meta property=\"og:site_name\" content=\"Web Hosting FAQs by MilesWeb\" \/>\n<meta property=\"article:published_time\" content=\"2020-08-18T05:46:31+00:00\" \/>\n<meta name=\"author\" content=\"Sonam Wagh\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Sonam Wagh\" \/>\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\":\"https:\/\/www.milesweb.in\/hosting-faqs\/how-to-change-a-password-for-postgresql\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/www.milesweb.in\/hosting-faqs\/how-to-change-a-password-for-postgresql\/\"},\"author\":{\"name\":\"Sonam Wagh\",\"@id\":\"https:\/\/www.milesweb.in\/hosting-faqs\/#\/schema\/person\/dc645d02823c86e07e53798ebe02c6f4\"},\"headline\":\"How to change a password for PostgreSQL on Linux via Command line?\",\"datePublished\":\"2020-08-18T05:46:31+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/www.milesweb.in\/hosting-faqs\/how-to-change-a-password-for-postgresql\/\"},\"wordCount\":222,\"commentCount\":0,\"keywords\":[\"Authentication\",\"Authentication method\",\"CentOS\",\"database\",\"Fedora\",\"md5\",\"password\",\"postgres\",\"psql\",\"Systemctl\",\"Systemd\",\"Ubuntu\"],\"articleSection\":[\"How-Tos\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/www.milesweb.in\/hosting-faqs\/how-to-change-a-password-for-postgresql\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.milesweb.in\/hosting-faqs\/how-to-change-a-password-for-postgresql\/\",\"url\":\"https:\/\/www.milesweb.in\/hosting-faqs\/how-to-change-a-password-for-postgresql\/\",\"name\":\"How to change a password for PostgreSQL on Linux via Command line? - Web Hosting FAQs by MilesWeb\",\"isPartOf\":{\"@id\":\"https:\/\/www.milesweb.in\/hosting-faqs\/#website\"},\"datePublished\":\"2020-08-18T05:46:31+00:00\",\"author\":{\"@id\":\"https:\/\/www.milesweb.in\/hosting-faqs\/#\/schema\/person\/dc645d02823c86e07e53798ebe02c6f4\"},\"description\":\"The knowledgebase explains how to change the password for PostgreSQL on Linux using the command line.\",\"breadcrumb\":{\"@id\":\"https:\/\/www.milesweb.in\/hosting-faqs\/how-to-change-a-password-for-postgresql\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.milesweb.in\/hosting-faqs\/how-to-change-a-password-for-postgresql\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.milesweb.in\/hosting-faqs\/how-to-change-a-password-for-postgresql\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.milesweb.in\/hosting-faqs\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"How to change a password for PostgreSQL on Linux via Command line?\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.milesweb.in\/hosting-faqs\/#website\",\"url\":\"https:\/\/www.milesweb.in\/hosting-faqs\/\",\"name\":\"Web Hosting FAQs by MilesWeb\",\"description\":\"\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.milesweb.in\/hosting-faqs\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.milesweb.in\/hosting-faqs\/#\/schema\/person\/dc645d02823c86e07e53798ebe02c6f4\",\"name\":\"Sonam Wagh\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.milesweb.in\/hosting-faqs\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/www.milesweb.in\/hosting-faqs\/wp-content\/uploads\/2019\/12\/Sonam-Wagh-150x150.jpg\",\"contentUrl\":\"https:\/\/www.milesweb.in\/hosting-faqs\/wp-content\/uploads\/2019\/12\/Sonam-Wagh-150x150.jpg\",\"caption\":\"Sonam Wagh\"},\"description\":\"With an interest in doing something creative daily, Sonam works as a Digital Marketing Executive. She likes to write technical blogs related to web hosting, digital marketing, and other IT topics. She also likes to spend her leisure time on social media to find different strategies for client engagement.\",\"url\":\"https:\/\/www.milesweb.in\/hosting-faqs\/author\/sonam\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"How to change a password for PostgreSQL on Linux via Command line? - Web Hosting FAQs by MilesWeb","description":"The knowledgebase explains how to change the password for PostgreSQL on Linux using the command line.","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":"https:\/\/www.milesweb.in\/hosting-faqs\/how-to-change-a-password-for-postgresql\/","og_locale":"en_US","og_type":"article","og_title":"How to change a password for PostgreSQL on Linux via Command line? - Web Hosting FAQs by MilesWeb","og_description":"The knowledgebase explains how to change the password for PostgreSQL on Linux using the command line.","og_url":"https:\/\/www.milesweb.in\/hosting-faqs\/how-to-change-a-password-for-postgresql\/","og_site_name":"Web Hosting FAQs by MilesWeb","article_published_time":"2020-08-18T05:46:31+00:00","author":"Sonam Wagh","twitter_misc":{"Written by":"Sonam Wagh","Est. reading time":"1 minute"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.milesweb.in\/hosting-faqs\/how-to-change-a-password-for-postgresql\/#article","isPartOf":{"@id":"https:\/\/www.milesweb.in\/hosting-faqs\/how-to-change-a-password-for-postgresql\/"},"author":{"name":"Sonam Wagh","@id":"https:\/\/www.milesweb.in\/hosting-faqs\/#\/schema\/person\/dc645d02823c86e07e53798ebe02c6f4"},"headline":"How to change a password for PostgreSQL on Linux via Command line?","datePublished":"2020-08-18T05:46:31+00:00","mainEntityOfPage":{"@id":"https:\/\/www.milesweb.in\/hosting-faqs\/how-to-change-a-password-for-postgresql\/"},"wordCount":222,"commentCount":0,"keywords":["Authentication","Authentication method","CentOS","database","Fedora","md5","password","postgres","psql","Systemctl","Systemd","Ubuntu"],"articleSection":["How-Tos"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.milesweb.in\/hosting-faqs\/how-to-change-a-password-for-postgresql\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.milesweb.in\/hosting-faqs\/how-to-change-a-password-for-postgresql\/","url":"https:\/\/www.milesweb.in\/hosting-faqs\/how-to-change-a-password-for-postgresql\/","name":"How to change a password for PostgreSQL on Linux via Command line? - Web Hosting FAQs by MilesWeb","isPartOf":{"@id":"https:\/\/www.milesweb.in\/hosting-faqs\/#website"},"datePublished":"2020-08-18T05:46:31+00:00","author":{"@id":"https:\/\/www.milesweb.in\/hosting-faqs\/#\/schema\/person\/dc645d02823c86e07e53798ebe02c6f4"},"description":"The knowledgebase explains how to change the password for PostgreSQL on Linux using the command line.","breadcrumb":{"@id":"https:\/\/www.milesweb.in\/hosting-faqs\/how-to-change-a-password-for-postgresql\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.milesweb.in\/hosting-faqs\/how-to-change-a-password-for-postgresql\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.milesweb.in\/hosting-faqs\/how-to-change-a-password-for-postgresql\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.milesweb.in\/hosting-faqs\/"},{"@type":"ListItem","position":2,"name":"How to change a password for PostgreSQL on Linux via Command line?"}]},{"@type":"WebSite","@id":"https:\/\/www.milesweb.in\/hosting-faqs\/#website","url":"https:\/\/www.milesweb.in\/hosting-faqs\/","name":"Web Hosting FAQs by MilesWeb","description":"","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.milesweb.in\/hosting-faqs\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/www.milesweb.in\/hosting-faqs\/#\/schema\/person\/dc645d02823c86e07e53798ebe02c6f4","name":"Sonam Wagh","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.milesweb.in\/hosting-faqs\/#\/schema\/person\/image\/","url":"https:\/\/www.milesweb.in\/hosting-faqs\/wp-content\/uploads\/2019\/12\/Sonam-Wagh-150x150.jpg","contentUrl":"https:\/\/www.milesweb.in\/hosting-faqs\/wp-content\/uploads\/2019\/12\/Sonam-Wagh-150x150.jpg","caption":"Sonam Wagh"},"description":"With an interest in doing something creative daily, Sonam works as a Digital Marketing Executive. She likes to write technical blogs related to web hosting, digital marketing, and other IT topics. She also likes to spend her leisure time on social media to find different strategies for client engagement.","url":"https:\/\/www.milesweb.in\/hosting-faqs\/author\/sonam\/"}]}},"_links":{"self":[{"href":"https:\/\/www.milesweb.in\/hosting-faqs\/wp-json\/wp\/v2\/posts\/10107","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.milesweb.in\/hosting-faqs\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.milesweb.in\/hosting-faqs\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.milesweb.in\/hosting-faqs\/wp-json\/wp\/v2\/users\/18"}],"replies":[{"embeddable":true,"href":"https:\/\/www.milesweb.in\/hosting-faqs\/wp-json\/wp\/v2\/comments?post=10107"}],"version-history":[{"count":1,"href":"https:\/\/www.milesweb.in\/hosting-faqs\/wp-json\/wp\/v2\/posts\/10107\/revisions"}],"predecessor-version":[{"id":10108,"href":"https:\/\/www.milesweb.in\/hosting-faqs\/wp-json\/wp\/v2\/posts\/10107\/revisions\/10108"}],"wp:attachment":[{"href":"https:\/\/www.milesweb.in\/hosting-faqs\/wp-json\/wp\/v2\/media?parent=10107"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.milesweb.in\/hosting-faqs\/wp-json\/wp\/v2\/categories?post=10107"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.milesweb.in\/hosting-faqs\/wp-json\/wp\/v2\/tags?post=10107"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}