{"id":391,"date":"2021-07-23T12:28:59","date_gmt":"2021-07-23T12:28:59","guid":{"rendered":"https:\/\/ssdsunucum.com\/blog\/how-to-resolve-password-authentication-failed-errors-in-postgresql\/"},"modified":"2021-07-23T12:28:59","modified_gmt":"2021-07-23T12:28:59","slug":"how-to-resolve-password-authentication-failed-errors-in-postgresql","status":"publish","type":"post","link":"https:\/\/ssdsunucum.com\/blog\/how-to-resolve-password-authentication-failed-errors-in-postgresql\/","title":{"rendered":"How to Resolve Password Authentication Failed Errors in PostgreSQL\u00ae"},"content":{"rendered":"<\/p>\n<div class=\"col-md-9\">\n<div class=\"flex-column flex-md-row article-header\"><\/div>\n<hr>\n<h2 id=\"overview\">Overview<\/h2>\n<p>If your server returns a Password authentication failed for user error when you try to access MySQL\u00ae resources, the most likely culprit is an invalid or missing PostgreSQL\u00ae user password.<\/p>\n<h2 id=\"solution\">Solution<\/h2>\n<p>Check the <code>\/root\/.pgpass<\/code> password file to confirm that the password exists in <code>::*:postgres:PASSWORD<\/code> format.<\/p>\n<p>If the password does not exist, you must edit the <code>\/var\/lib\/pgsql\/data\/pg_hba.conf<\/code> file directly. To do this:<\/p>\n<ol>\n<li>\n<p>Stop Tailwatch. To do this, run the following commands:\n<\/p>\n<div class=\"highlight\">\n<div style=\"color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4\">\n<table style=\"border-spacing:0;padding:0;margin:0;border:0;width:auto;overflow:auto;display:block;\">\n<tr>\n<td style=\"vertical-align:top;padding:0;margin:0;border:0;\">\n<pre style=\"color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4\"><code class=\"language-go\" data-lang=\"go\"><span style=\"margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f\">1\n<\/span><span style=\"margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f\">2\n<\/span><\/code><\/pre>\n<\/td>\n<td style=\"vertical-align:top;padding:0;margin:0;border:0;;width:100%\">\n<pre style=\"color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4\"><code class=\"language-go\" data-lang=\"go\"><span style=\"color:#a6e22e\">touch<\/span> <span style=\"color:#f92672\">\/<\/span><span style=\"color:#a6e22e\">etc<\/span><span style=\"color:#f92672\">\/<\/span><span style=\"color:#a6e22e\">tailwatchddisable<\/span>\n<span style=\"color:#a6e22e\">killall<\/span> <span style=\"color:#a6e22e\">tailwatchd<\/span><\/code><\/pre>\n<\/td>\n<\/tr>\n<\/table>\n<\/div>\n<\/div>\n<\/li>\n<li>\n<p>Edit the <code>\/var\/lib\/pgsql\/data\/pg_hba.conf<\/code> file and change the <code>md5<\/code> value to the <code>trust<\/code> value.<\/p>\n<\/li>\n<li>\n<p>Restart PostgreSQL. To do this, run the <code>\/usr\/local\/cpanel\/scripts\/restartsrv_postgresql<\/code> command.<\/p>\n<\/li>\n<li>\n<p>Change the PostgreSQL password. To do this, run the following command, where <code>new_pass<\/code> represents the new password:\n<\/p>\n<div class=\"highlight\">\n<pre style=\"color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4\"><code class=\"language-BASH\" data-lang=\"BASH\">postgres<span style=\"color:#f92672\">=<\/span><span style=\"color:#75715e\"># alter user postgres with encrypted password =new_pass postgres=# q<\/span><\/code><\/pre>\n<\/div>\n<\/li>\n<li>\n<p>Edit the <code>\/var\/lib\/pgsql\/data\/pg_hba.conf<\/code> file and change the <code>trust<\/code> value to the <code>md5<\/code> value.<\/p>\n<\/li>\n<li>\n<p>Remove the Tailwatch touch file and restart the service. To do this, run the following commands:\n<\/p>\n<div class=\"highlight\">\n<div style=\"color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4\">\n<table style=\"border-spacing:0;padding:0;margin:0;border:0;width:auto;overflow:auto;display:block;\">\n<tr>\n<td style=\"vertical-align:top;padding:0;margin:0;border:0;\">\n<pre style=\"color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4\"><code class=\"language-go\" data-lang=\"go\"><span style=\"margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f\">1\n<\/span><span style=\"margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f\">2\n<\/span><\/code><\/pre>\n<\/td>\n<td style=\"vertical-align:top;padding:0;margin:0;border:0;;width:100%\">\n<pre style=\"color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4\"><code class=\"language-go\" data-lang=\"go\"><span style=\"color:#a6e22e\">rm<\/span> <span style=\"color:#f92672\">\/<\/span><span style=\"color:#a6e22e\">etc<\/span><span style=\"color:#f92672\">\/<\/span><span style=\"color:#a6e22e\">tailwatchddisable<\/span>\n<span style=\"color:#f92672\">\/<\/span><span style=\"color:#a6e22e\">usr<\/span><span style=\"color:#f92672\">\/<\/span><span style=\"color:#a6e22e\">local<\/span><span style=\"color:#f92672\">\/<\/span><span style=\"color:#a6e22e\">cpanel<\/span><span style=\"color:#f92672\">\/<\/span><span style=\"color:#a6e22e\">scripts<\/span><span style=\"color:#f92672\">\/<\/span><span style=\"color:#a6e22e\">restartsrv_tailwatchd<\/span><\/code><\/pre>\n<\/td>\n<\/tr>\n<\/table>\n<\/div>\n<\/div>\n<\/li>\n<\/ol>\n<p>Previously, the system stored passwords in the <code>\/var\/lib\/pgsql\/.pgpass<\/code> file.<\/p>\n<p>If the <code>\/root\/.pgpass<\/code> file does not exist, the system copies the <code>.pgpass<\/code> file to the <code>\/root\/.pgpass<\/code> file.<\/p>\n<\/p><\/div>\n","protected":false},"excerpt":{"rendered":"<p>Overview If your server returns a Password authentication failed for user error when you try to access MySQL\u00ae resources, the most likely culprit is an invalid or missing PostgreSQL\u00ae user password. Solution Check the \/root\/.pgpass password file to confirm that the password exists in ::*:postgres:PASSWORD format. If the password does not exist, you must edit &hellip;<\/p>\n","protected":false},"author":1,"featured_media":392,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[1],"tags":[],"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/ssdsunucum.com\/blog\/wp-json\/wp\/v2\/posts\/391"}],"collection":[{"href":"https:\/\/ssdsunucum.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/ssdsunucum.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/ssdsunucum.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/ssdsunucum.com\/blog\/wp-json\/wp\/v2\/comments?post=391"}],"version-history":[{"count":0,"href":"https:\/\/ssdsunucum.com\/blog\/wp-json\/wp\/v2\/posts\/391\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/ssdsunucum.com\/blog\/wp-json\/wp\/v2\/media\/392"}],"wp:attachment":[{"href":"https:\/\/ssdsunucum.com\/blog\/wp-json\/wp\/v2\/media?parent=391"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ssdsunucum.com\/blog\/wp-json\/wp\/v2\/categories?post=391"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ssdsunucum.com\/blog\/wp-json\/wp\/v2\/tags?post=391"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}