<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Maneesha Walisundera</title>
    <description>The latest articles on DEV Community by Maneesha Walisundera (@maneesha14w).</description>
    <link>https://dev.to/maneesha14w</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F1260547%2F5793fdee-9a37-4b8a-b7a2-5aba988424a8.jpeg</url>
      <title>DEV Community: Maneesha Walisundera</title>
      <link>https://dev.to/maneesha14w</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/maneesha14w"/>
    <language>en</language>
    <item>
      <title>How to setup PostgreSQL and DBeaver on WSL.</title>
      <dc:creator>Maneesha Walisundera</dc:creator>
      <pubDate>Sun, 28 Jan 2024 08:26:05 +0000</pubDate>
      <link>https://dev.to/maneesha14w/how-to-setup-postgresql-and-dbeaver-on-wsl-3hkd</link>
      <guid>https://dev.to/maneesha14w/how-to-setup-postgresql-and-dbeaver-on-wsl-3hkd</guid>
      <description>&lt;p&gt;Spent a few hours trying to configure PostgreSQL and DBeaver on wsl. Hope this helps. &lt;/p&gt;

&lt;h2&gt;
  
  
  Installing postgresql on wsl terminal
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ sudo apt update
$ sudo apt install postgresql postgresql-contrib
$ psql --version
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Give it a password that we will use in Dbeaver when testing connection.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;code&gt;$ sudo passwd postgres&lt;/code&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Restart Terminal.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Check status and start PostgreSQL service.&lt;br&gt;
&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ sudo service postgresql status
$ sudo service postgresql start
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;You should get a prompt asking for your password.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;If you didn't, then type :&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ su - postgres
$ psql
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;After entering your password you should see this&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;code&gt;postgres=#&lt;/code&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Keep terminal open&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  DBeaver Setup
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Open DBeaver after installing from &lt;a href="https://dbeaver.io/download/" rel="noopener noreferrer"&gt;here&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Ctrl - Shift - N to make a new connection and select PostgreSQL.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Fill your password you entered earlier and click test connection.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fxpcg0yjf15cvy6igs9u7.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fxpcg0yjf15cvy6igs9u7.png" alt="DBeaver postgres pop up" width="693" height="733"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;It should ask you to download some drivers. After downloading it should be working.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fpfus2l5uwzwgwm008i8u.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fpfus2l5uwzwgwm008i8u.png" alt="Test Success" width="428" height="353"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;If you get an error, lets try reseting password and creating dummydb.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;go back to your terminal \q out and
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ sudo -u postgres createuser &amp;lt;username&amp;gt;
$ sudo -u postgres createdb &amp;lt;dummydbname&amp;gt;
$ sudo -u postgres psql
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;psql=# alter user postgres with encrypted password '&amp;lt;password&amp;gt;'
psql=# grant all privileges on database &amp;lt;dbname&amp;gt; to postgres 
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Close DBeaver and retry testing your connection.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;If you get an connection error&lt;br&gt;
&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sudo ufw allow 5432/tcp
# You should see "Rules updated" and/or "Rules updated (v6)"
sudo service postgresql restart
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Open powershell as admin
&lt;code&gt;wsl --shutdown&lt;/code&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Start postgresql service and Retry connection.&lt;/p&gt;

</description>
      <category>wsl</category>
      <category>postgres</category>
      <category>postgressql</category>
      <category>dbeaver</category>
    </item>
  </channel>
</rss>
