<turbo-stream action="append" target="posts_list"><template>    <div class="postbit" id="232895" data-post-id="232895">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="silverdr" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/silverdr/120/23771_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  silverdr
                  </h3>
		          </div>
						
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>FWIW - I just tried to set a quick test project up and I recalled the discussion here so I thought I’d check it. Therefore I left both user and password at the default “postgres” and encountered the same issue/errors OP described in his first post. The solution in my case:</p>
<pre data-code-wrap="elixir"><code class="lang-elixir">silverdr$ sudo -u postgres psql
psql (12.9 (Ubuntu 12.9-0ubuntu0.20.04.1))
Type "help" for help.

postgres=# \password postgres
Enter new password: 
Enter it again: 
postgres=# \q
silverdr$ mix ecto.create
Compiling 29 files (.ex)
Generated testapp app
The database for Testapp.Repo has been created
</code></pre>
<p>IOW - altering the ROLE “postgres” to have password “postgres” helped immediately. This is basically the same what <a class="mention" href="/u/inko" rel="nofollow">@inko</a> mentioned: if you want to use the “postgres” role, give it the password you have cofigured in the Elixir application config.</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="232895" data-batch-url="/posts/batch_likers">
                        4
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/postgrex-error-fatal-28p01-invalid-password-password-authentication-failed-for-user-postgres/43756/12">Post #11</a>
	                </div>
	            </div>
              <div id="likers-container-232895" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="232895"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-standard-post cat-standard-post" title="Post #11"></div>
  </section>
</div>
    <div class="postbit" id="263519" data-post-id="263519">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="jack3" src="/assets/icons/user-9f439610.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  jack3
                  </h3>
		          </div>
						
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>I was getting this error when trying to access docker-based postgres from locally compiled phoenix app. The issue was the presence of an another running postgres service (locally on windows). Stopping local postgres resolved the issue.</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="263519" data-batch-url="/posts/batch_likers">
                        0
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/postgrex-error-fatal-28p01-invalid-password-password-authentication-failed-for-user-postgres/43756/13">Post #12</a>
	                </div>
	            </div>
              <div id="likers-container-263519" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="263519"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-standard-post cat-standard-post" title="Post #12"></div>
  </section>
</div>
    <div class="postbit" id="277482" data-post-id="277482">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="hp77-creator" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/hp77-creator/120/24889_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  hp77-creator
                  </h3>
		          </div>
						
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>I tried to add a password but the issue persists even after restarting postgresql. I just created a new folder using <code>mix phx.new &lt;name&gt;</code> but no help.</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="277482" data-batch-url="/posts/batch_likers">
                        0
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/postgrex-error-fatal-28p01-invalid-password-password-authentication-failed-for-user-postgres/43756/14">Post #13</a>
	                </div>
	            </div>
              <div id="likers-container-277482" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="277482"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-standard-post cat-standard-post" title="Post #13"></div>
  </section>
</div>
    <div class="postbit" id="277486" data-post-id="277486">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="silverdr" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/silverdr/120/23771_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  silverdr
                  </h3>
		          </div>
						
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>How did you try to add the password?</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="277486" data-batch-url="/posts/batch_likers">
                        0
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/postgrex-error-fatal-28p01-invalid-password-password-authentication-failed-for-user-postgres/43756/15">Post #14</a>
	                </div>
	            </div>
              <div id="likers-container-277486" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="277486"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-standard-post cat-standard-post" title="Post #14"></div>
  </section>
</div>
    <div class="postbit" id="277487" data-post-id="277487">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="hp77-creator" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/hp77-creator/120/24889_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  hp77-creator
                  </h3>
		          </div>
						
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>I tried your method of logging into <code>psql</code> then using <code>password</code> and another time by <code>alter</code> statement.</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="277487" data-batch-url="/posts/batch_likers">
                        0
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/postgrex-error-fatal-28p01-invalid-password-password-authentication-failed-for-user-postgres/43756/16">Post #15</a>
	                </div>
	            </div>
              <div id="likers-container-277487" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="277487"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-standard-post cat-standard-post" title="Post #15"></div>
  </section>
</div>
    <div class="postbit" id="277494" data-post-id="277494">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="silverdr" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/silverdr/120/23771_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  silverdr
                  </h3>
		          </div>
						
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>OK, I assume you know how it works but for double-checking could you please post:</p>
<ul>
<li>your exact environment (OS version/DB version/etc)</li>
<li>how exactly have you tried to change password using “ALTER”</li>
<li>how exactly you created new project</li>
<li>how exactly you start the task that gives you the error</li>
<li>the exact error</li>
</ul> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="277494" data-batch-url="/posts/batch_likers">
                        0
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/postgrex-error-fatal-28p01-invalid-password-password-authentication-failed-for-user-postgres/43756/17">Post #16</a>
	                </div>
	            </div>
              <div id="likers-container-277494" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="277494"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-standard-post cat-standard-post" title="Post #16"></div>
  </section>
</div>
    <div class="postbit" id="277667" data-post-id="277667">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="hp77-creator" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/hp77-creator/120/24889_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  hp77-creator
                  </h3>
		          </div>
						
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>Alright. Here is what you asked for:</p>
<ul>
<li>OS: Debian 11.6, DB Version: postgres (PostgreSQL) 13.9 (Debian 13.9-0+deb11u1)</li>
<li>I first wrote <code>sudo -u postgres psql</code> then wrote <code> alter role postgres with encrypted password 'postgres'</code> and received a prompt that roles were changed.</li>
<li>I created a new project by doing <code>mix phx.new hello_db</code></li>
<li>I received the error when I was doing <code>mix ecto.create</code></li>
<li>The exact error was how the OP started this thread but today when I tried to create a new project, I am receiving a ‘DB Connection refused error’, I checked out other threads on the forum and they said my postgres service might not be running but I did check using <code>sudo systemctl status postgres</code> and it was <code>active</code>.</li>
</ul> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="277667" data-batch-url="/posts/batch_likers">
                        0
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/postgrex-error-fatal-28p01-invalid-password-password-authentication-failed-for-user-postgres/43756/18">Post #17</a>
	                </div>
	            </div>
              <div id="likers-container-277667" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="277667"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-standard-post cat-standard-post" title="Post #17"></div>
  </section>
</div>
    <div class="postbit" id="277831" data-post-id="277831">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="silverdr" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/silverdr/120/23771_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  silverdr
                  </h3>
		          </div>
						
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>Well, then I can’t really help. As discussed here and in a few other places - the default installation of PostgreSQL does not have password set for the “Superuser” <code>postgres</code>, while the default Phoenix <code>dev.exs</code> configuration file expects it to have - example below</p>
<pre data-code-wrap="elixir"><code class="lang-elixir"># Configure your database
config :gin, Gin.Repo,
  username: "postgres",
  password: "postgres",
  hostname: "localhost",
  database: "gin_dev",
  show_sensitive_data_on_connection_error: true,
  pool_size: 10
</code></pre>
<p>This is solved either by adding password to <code>postgres</code> “ROLE” or by creating and using a “non-superuser” role (with password) for your development purposes and adapting the <code>dev.exs</code> section responsible for connecting to the database. The latter is my preferred approach.</p>
<p>What I’d suggest checking is your <code>dev.exs</code> and whether your Phoenix application and your <code>psql</code> connect to the same PostgreSQL instance. Might you be having more than one PostgreSQL somewhere around your machine(s)?</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="277831" data-batch-url="/posts/batch_likers">
                        0
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/postgrex-error-fatal-28p01-invalid-password-password-authentication-failed-for-user-postgres/43756/19">Post #18</a>
	                </div>
	            </div>
              <div id="likers-container-277831" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="277831"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-standard-post cat-standard-post" title="Post #18"></div>
  </section>
</div>
    <div class="postbit" id="277887" data-post-id="277887">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="sbuttgereit" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/sbuttgereit/120/30162_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  sbuttgereit
                  </h3>
		          </div>
						
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>Having a password set for the <code>postgres</code> account is a necessary step, but not the only one you need to take on Debian based distro (if memory serves).  <code>pg_hba.conf</code> also needs to be configured to allow you to authenticate with a password.  I didn’t see that discussed so it might yet be part of the problem.</p>
<p>There are basic instructions here (ignore the pgadmin references):</p><aside class="onebox allowlistedgeneric" data-onebox-src="https://help.ubuntu.com/community/PostgreSQL#Using_pgAdmin_III_GUI">
  <header class="source">

      <a href="https://help.ubuntu.com/community/PostgreSQL#Using_pgAdmin_III_GUI" target="_blank" rel="noopener nofollow ugc">help.ubuntu.com</a>
  </header>

  <article class="onebox-body">
    

<h3><a href="https://help.ubuntu.com/community/PostgreSQL#Using_pgAdmin_III_GUI" target="_blank" rel="noopener nofollow ugc">Using pgAdmin III GUI - PostgreSQL - Community Help Wiki</a></h3>

  <p>To get an idea of what PostgreSQL can do, you may start by firing up a graphical client. In a terminal type :</p>


  </article>

  <div class="onebox-metadata">
    
    
  </div>

  <div style="clear: both"></div>
</aside>

<p>and better documentation here:</p><aside class="onebox allowlistedgeneric" data-onebox-src="https://www.postgresql.org/docs/current/auth-pg-hba-conf.html">
  <header class="source">
      <img src="https://www.postgresql.org/favicon.ico" class="site-icon" alt="" width="48" height="48">

      <a href="https://www.postgresql.org/docs/current/auth-pg-hba-conf.html" target="_blank" rel="noopener nofollow ugc" title="01:09PM - 14 May 2026">PostgreSQL Documentation – 14 May 26</a>
  </header>

  <article class="onebox-body">
    <div class="aspect-image" style="--aspect-ratio:540/557;"><img src="https://www.postgresql.org/media/img/about/press/elephant.png" class="thumbnail" alt="" width="540" height="557"></div>

<h3><a href="https://www.postgresql.org/docs/current/auth-pg-hba-conf.html" target="_blank" rel="noopener nofollow ugc">20.1.&nbsp;The pg_hba.conf File</a></h3>

  <p>20.1.&nbsp;The pg_hba.conf File # Client authentication is controlled by a configuration file, which traditionally is named pg_hba.conf and is stored …</p>


  </article>

  <div class="onebox-metadata">
    
    
  </div>

  <div style="clear: both"></div>
</aside>

<p>By default PostgreSQL only listens on <code>localhost</code> though from what I can see that probably won’t be an issue for you.  If it becomes a problem, it’s worthwhile being aware of the <code>listen_addresses</code> configuration point in <code>postgresql.conf</code>.</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="277887" data-batch-url="/posts/batch_likers">
                        0
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/postgrex-error-fatal-28p01-invalid-password-password-authentication-failed-for-user-postgres/43756/20">Post #19</a>
	                </div>
	            </div>
              <div id="likers-container-277887" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="277887"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-standard-post cat-standard-post" title="Post #19"></div>
  </section>
</div>
    <div class="postbit" id="282063" data-post-id="282063">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="hamid1882" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/hamid1882/120/29905_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  hamid1882
                  </h3>
		          </div>
						
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>thanks for this, It helped me</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="282063" data-batch-url="/posts/batch_likers">
                        0
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/postgrex-error-fatal-28p01-invalid-password-password-authentication-failed-for-user-postgres/43756/21">Post #20</a>
	                </div>
	            </div>
              <div id="likers-container-282063" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="282063"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-last-post cat-last-post" title="Last post!"></div>
  </section>
</div>
</template></turbo-stream><turbo-stream action="replace" target="load-more-container"><template><div id="load-more-container" class="load-more-container">
    <span class="all-loaded">— All posts loaded —</span>
</div></template></turbo-stream>