<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Bolaji on Medium]]></title>
        <description><![CDATA[Stories by Bolaji on Medium]]></description>
        <link>https://medium.com/@cooProton?source=rss-5d97add8fae6------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*4s_SYPd39aXa5WE1.jpg</url>
            <title>Stories by Bolaji on Medium</title>
            <link>https://medium.com/@cooProton?source=rss-5d97add8fae6------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 16 Nov 2026 06:31:59 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@cooProton/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Time]]></title>
            <link>https://medium.com/@cooProton/time-380999713374?source=rss-5d97add8fae6------2</link>
            <guid isPermaLink="false">https://medium.com/p/380999713374</guid>
            <dc:creator><![CDATA[Bolaji]]></dc:creator>
            <pubDate>Mon, 17 Apr 2023 00:36:19 GMT</pubDate>
            <atom:updated>2023-04-17T00:36:19.204Z</atom:updated>
            <content:encoded><![CDATA[<iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FW7Lmi_uemSc%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DW7Lmi_uemSc&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FW7Lmi_uemSc%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="640" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/517d3357d6b544b94b39122ae98797ec/href">https://medium.com/media/517d3357d6b544b94b39122ae98797ec/href</a></iframe><p>Lately, this song has been stuck on replay and one of the things that I keep thinking about after listening to it is the concept of time.</p><p>Growing up, I learned that time is a currency. It can be wasted and it can be spent.</p><p>Time is so valuable and it’s one of the reasons why I endeavor not to waste anyone’s time and why I get pissed when someone destroys mine. Time is also about an experience because the time that isn’t wasted has to be spent on something and experience is basically you doing something a lot of times to the point where it becomes extra easy for you to do it.</p><p>Listening to <a href="https://anniemusic.app/t/5548">Mr. Hudson’s time</a>, the first words of the song really caught my ears:</p><blockquote>Time is all I fear, it’s why I just keep running</blockquote><p>And this is valid to me because life is basically you running down the clock (time). Death comes when you’ve run down your clock.</p><p>Value your time.</p><p>Value your experiences.</p><p>Value your life.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*LgxzmI3MwRQ7UwdfVli3nw.jpeg" /><figcaption>Random image of a clock from Unsplash: <a href="https://unsplash.com/photos/FfbVFLAVscw">https://unsplash.com/photos/FfbVFLAVscw</a></figcaption></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=380999713374" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[There is a wave …]]></title>
            <link>https://medium.com/@cooProton/there-is-a-wave-870bdc6bab7f?source=rss-5d97add8fae6------2</link>
            <guid isPermaLink="false">https://medium.com/p/870bdc6bab7f</guid>
            <category><![CDATA[waves]]></category>
            <dc:creator><![CDATA[Bolaji]]></dc:creator>
            <pubDate>Thu, 28 Apr 2022 00:40:25 GMT</pubDate>
            <atom:updated>2022-04-28T00:40:25.448Z</atom:updated>
            <content:encoded><![CDATA[<h3>There is a wave …</h3><figure><img alt="picture of a wave" src="https://cdn-images-1.medium.com/max/1024/1*bStfjqtiq51zVkgnZPBXww.png" /><figcaption>Sea Splash by Silas Baisch</figcaption></figure><p>I’ve spent roughly 98 days trying to write this up, not because it’s a hard topic to write about but because of the following reasons:</p><ol><li>I’ve not written an article in a while (over 18 months)</li><li>It’s a bit tough articulating the way I feel into words and sharing.</li></ol><p>I advise listening to the track below while reading, as it helps to put you in the mood I was in when I was writing this and hope you not only read what I have to write, but also feel it so you can understand/relate.</p><p><em>PS: This is me ranting — there’s no conclusion per se at the end of this article lol.</em></p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fopen.spotify.com%2Fembed%2Ftrack%2F1I1wo7OASJIaQ9EgOrW9Dw%3Futm_source%3Doembed&amp;display_name=Spotify&amp;url=https%3A%2F%2Fopen.spotify.com%2Ftrack%2F1I1wo7OASJIaQ9EgOrW9Dw&amp;image=https%3A%2F%2Fi.scdn.co%2Fimage%2Fab67616d00001e021721039eb3dfadd939938d70&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=spotify" width="456" height="80" frameborder="0" scrolling="no"><a href="https://medium.com/media/92fe7e7713a33acc95c73a53549a1c96/href">https://medium.com/media/92fe7e7713a33acc95c73a53549a1c96/href</a></iframe><p><a href="https://anniemusic.app/t/4405">View Track</a> on AnnieMusic</p><p>It’s been a somewhat rough couple of months, dealing with the pandemic for almost a whole year and what has been uncertainties generally in life. There have been reports of a new kind of bird flu somewhere in Asia and everyone has to keep on living like nothing is happening.</p><p>Recently, I spoke with a couple of friends and I‘ve been doing some twitter investigation also (haha), and that made me realize there’s a wave of fatigue going around (affecting quite a number of people).</p><h3>Oreoluwa on Twitter: &quot;Living life and understanding that the downtime is going to come. - Viola Davis / Twitter&quot;</h3><p>Living life and understanding that the downtime is going to come. - Viola Davis</p><p>I’ve lived my life so far with an understanding that life is a mix of ups and downs, I’ve adapted to that lifestyle but I think so far nothing prepares us for the current downtime we are all facing. It’s so weird, we might have to go on another lockdown again (due to the bird flu virus, maybe) — where do we then start from?</p><p>We are still adjusting to living our life wearing masks and this is coming around lol.</p><p>— — — — — — — — — — — — — — -</p><p>Do you feel like you’re not doing enough?</p><p>Do you feel like you’re doing a lot?</p><p>Do you feel time passing by like a breeze?</p><p>Do you feel like the world is moving so fast and you’re in slow-mo?</p><p>Are you overwhelmed because of all the decisions you’ve got to make?</p><p>Are you constantly worried about what the future holds?</p><p>You’re not alone.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=870bdc6bab7f" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[You’re not crazy, the world is.]]></title>
            <link>https://medium.com/@cooProton/youre-not-crazy-the-world-is-f67a093987d5?source=rss-5d97add8fae6------2</link>
            <guid isPermaLink="false">https://medium.com/p/f67a093987d5</guid>
            <dc:creator><![CDATA[Bolaji]]></dc:creator>
            <pubDate>Fri, 01 Apr 2022 14:59:49 GMT</pubDate>
            <atom:updated>2022-04-01T14:59:49.273Z</atom:updated>
            <content:encoded><![CDATA[<p>Believe me, you’re not.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f67a093987d5" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Bloom]]></title>
            <link>https://medium.com/@cooProton/bloom-98f8bdba7c0d?source=rss-5d97add8fae6------2</link>
            <guid isPermaLink="false">https://medium.com/p/98f8bdba7c0d</guid>
            <dc:creator><![CDATA[Bolaji]]></dc:creator>
            <pubDate>Thu, 05 Mar 2020 18:10:29 GMT</pubDate>
            <atom:updated>2020-03-05T21:02:29.860Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ema2INp5pIPuHwznahqHCA.jpeg" /></figure><p>In a room full of stars,</p><p>would you be the moon.</p><p>In a garage full of cars,</p><p>would you be a saloon.</p><p>Going on a journey so far,</p><p>away from people like you.</p><p>Rid myself of my heart,</p><p>so I could be your bloom.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=98f8bdba7c0d" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[You sold your sould]]></title>
            <link>https://medium.com/@cooProton/you-sold-your-sould-dd84b29c3a02?source=rss-5d97add8fae6------2</link>
            <guid isPermaLink="false">https://medium.com/p/dd84b29c3a02</guid>
            <dc:creator><![CDATA[Bolaji]]></dc:creator>
            <pubDate>Thu, 05 Mar 2020 17:50:01 GMT</pubDate>
            <atom:updated>2020-03-05T17:50:01.906Z</atom:updated>
            <content:encoded><![CDATA[<h3>You sold your soul</h3><p>You sold your soul<br>Not to the devil that you knew<br>But to the angel you haven’t met</p><p>Gold chains, rolls royce<br>Closed mouths don’t get fed<br>Stiff lips, unspoken choice<br>Poverty ain’t your friend</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=dd84b29c3a02" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Your Smile]]></title>
            <link>https://medium.com/@cooProton/your-smile-3701a1a0e06d?source=rss-5d97add8fae6------2</link>
            <guid isPermaLink="false">https://medium.com/p/3701a1a0e06d</guid>
            <category><![CDATA[smile]]></category>
            <dc:creator><![CDATA[Bolaji]]></dc:creator>
            <pubDate>Fri, 12 Jul 2019 23:35:32 GMT</pubDate>
            <atom:updated>2019-07-12T23:37:17.764Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-vf6V57yFZFnFBAVHt_2Pw.jpeg" /><figcaption>Credit: Gabriel Silverio via Unsplash</figcaption></figure><p>A daily reminder that happiness exist</p><p>A sight to remember</p><p>Might be the key to world peace</p><p>Might be the one thing that can change the world</p><p>A sight to behold</p><p>Your smile is an important part of you</p><p>Protect it.</p><p>Don’t lose that smile!!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3701a1a0e06d" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Dockerizing a Flask Application]]></title>
            <link>https://medium.com/backticks-tildes/dockerizing-a-flask-application-2b17ca9c1d1c?source=rss-5d97add8fae6------2</link>
            <guid isPermaLink="false">https://medium.com/p/2b17ca9c1d1c</guid>
            <category><![CDATA[programing]]></category>
            <category><![CDATA[docker]]></category>
            <category><![CDATA[flask]]></category>
            <dc:creator><![CDATA[Bolaji]]></dc:creator>
            <pubDate>Mon, 10 Jun 2019 13:19:26 GMT</pubDate>
            <atom:updated>2019-06-10T13:19:26.491Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*uiccE51rA9jFirejyitdJg.png" /><figcaption>Credit: Me 😆</figcaption></figure><p>Sometimes when developing we run into problems that seem specific to a particular OS especially when working in a team where the development environment isn’t similar. An example is when some members of a team use windows, some use Unix-based OS (Linux or MacOS).</p><p>An example I’ve run into personally is with node dependencies that make use of the node-gyp , the installation on windows can be weird at times. Cases like this calls for the use of a unified development environment, in the past developers made use of Virtual Machines(VM), but the cons of VMs became somewhat unbearable. A few of the cons are:</p><ul><li>VMs can be resource intensive</li><li>VMs can be difficult to set up</li></ul><p>You can read about the pros and cons <a href="https://www.cynexlink.com/2017/08/18/virtual-machines-pros-cons/">here</a> of using VM.</p><h4><strong>Docker</strong></h4><blockquote><strong>Docker</strong> is a tool designed to make it easier to create, deploy, and run applications by using containers. Containers allow a developer to package up an application with all of the parts it needs, such as libraries and other dependencies, and ship it all out as one package. — Open Source</blockquote><p>With Docker, we can be certain the development environment is the same for everyone and everyone basically has to run one command to start / build the application. Also it’s not as resource intensive as VMs.</p><p>Now we are going to get started with dockerizing a flask application.</p><h4>Technologies used</h4><ul><li>Flask</li><li>Pipenv</li><li>Docker</li><li>Python3</li></ul><p>I’ll skip most of the <strong>Python3 — Flask</strong> details right now because the focus of this article is on <strong>Docker</strong>. You can view the <a href="https://github.com/BolajiOlajide/docker-flask/tree/app-w/o-docker">flask app here</a>.</p><p>The flask app simply contains two routes:</p><ul><li>/ — displays a welcome message to the user</li><li>/info — displays the current date and time</li></ul><p>Setting up the application is pretty straight-forward, I documented the steps to take to set up in the <a href="https://github.com/BolajiOlajide/docker-flask/blob/app-w/o-docker/README.md">README</a> so you can take a look.</p><p>Now that that’s settled, we’re going to start dockerizing the flask application. The first thing we need to do is create a <a href="https://docs.docker.com/engine/reference/builder/">Dockerfile</a>.</p><blockquote>A Dockerfile is a text document that contains all the commands a user could call on the command line to assemble an image.</blockquote><p>The content of this file simply contains the step-by-step instructions Docker needs to run to assemble the image and start the application. The <strong>Dockerfile</strong> should be similar to the snippet attached below.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/dcbf905193719a8be19aeb6608b8b4f2/href">https://medium.com/media/dcbf905193719a8be19aeb6608b8b4f2/href</a></iframe><p>The first non-comment instruction in the <strong>Dockerfile</strong> is the <strong>FROM</strong> keyword which is specify the base image to be used. We’ll be making use of a python base image and since the README instructs us to use Python3 we can search for an image on <a href="https://hub.docker.com/_/python">Dockerhub</a> to use. I opted for the alpine variant of Python because it’s light weight.</p><p>Once that is done, we’ll be adding a LABEL to add some metadata information to the Dockerfile. After which we start doing some project-specific operations, we define a Work Directory with the command <strong>WORKDIR</strong>, this defines the main directory of operations because every command run after defining a <strong>WORKDIR</strong> is going to run from the <strong>WORKDIR</strong>.</p><p>After defining this, we copy the content from our machine to the docker container with the command COPY . . , the first . is to instruct docker to copy all the files in the current directory to the second . which is going to be the <strong>WORKDIR</strong> in the docker container. You can read about the <strong>COPY</strong> command <a href="https://docs.docker.com/develop/develop-images/dockerfile_best-practices#add-or-copy">here</a>.</p><p>The next two commands are used to install pipenv which happens to be the dependency manager used by the flask application. The <strong>RUN</strong> command is used to first install pipenv then we use it to run the command pipenv install — to install the project’s dependencies. You can read about the <strong>RUN</strong> command <a href="https://docs.docker.com/engine/reference/builder#run">here</a>.</p><p>The last command is the <strong>CMD</strong> command and is similar to the <strong>RUN</strong> command, you can read about it <a href="https://docs.docker.com/engine/reference/builder/#cmd">here</a>. It is used to run the command for starting the application which is pipenv run python main.py .</p><p>We are now ready to run our first docker build, but before we do that we need to make one final tweak to the flask application. We have to specify the host as <strong>0.0.0.0</strong>, the reason is that by default when you run the flask application the host defaults to localhost and this localhost will be in the context of the docker container which we don’t really have access to. Setting the host to 0.0.0.0 exposes the docker container so we can access it from our host machine. All we need to change is the app.run method in main.py which should now look this 👇</p><pre>if __name__ == &#39;__main__&#39;:</pre><pre>    app.run(host=&#39;0.0.0.0&#39;, debug=True)</pre><p>We can then build our image with the <a href="https://docs.docker.com/engine/reference/commandline/build/">docker build</a> command as shown below</p><pre>docker build . -t doc-flask:v1</pre><p>We use the -t flag to tag our image by naming it doc-flask and adding a version called v1 . With this method we can have several images with new changes that we can push up to a remote docker repository like DockerHub.</p><p>Once the build process is done, we can run the application with the <a href="https://docs.docker.com/engine/reference/commandline/run/">docker run</a> command as shown below</p><pre>docker run -p 5000:5000 doc-flask:v1</pre><p>The -p flag is used to map the port in the docker container to that of our host machine, we are simply mapping port 5000 in our docker container to port 5000 on our host machine so that we can access the app in the docker container via the url: localhost:5000.</p><p>We can test our app using Postman, Insomnia or whichever API client you prefer. We simply make a GET request to localhost:5000 and localhost:5000/info on our host machine and we should be getting some response.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*HA6K-e7JI6x-mD67S4WiZg.png" /><figcaption>Sample request to docker flask app</figcaption></figure><p>You can access the source code <a href="https://github.com/BolajiOlajide/docker-flask">here</a>.</p><p>Thanks for reading this article. Got feedback? Kindly share in the comments section below.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2b17ca9c1d1c" width="1" height="1" alt=""><hr><p><a href="https://medium.com/backticks-tildes/dockerizing-a-flask-application-2b17ca9c1d1c">Dockerizing a Flask Application</a> was originally published in <a href="https://medium.com/backticks-tildes">Backticks &amp; Tildes</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Too Young]]></title>
            <link>https://medium.com/@cooProton/too-young-50d996123d7e?source=rss-5d97add8fae6------2</link>
            <guid isPermaLink="false">https://medium.com/p/50d996123d7e</guid>
            <category><![CDATA[young]]></category>
            <category><![CDATA[oto]]></category>
            <category><![CDATA[old]]></category>
            <category><![CDATA[age]]></category>
            <dc:creator><![CDATA[Bolaji]]></dc:creator>
            <pubDate>Thu, 18 Apr 2019 02:14:53 GMT</pubDate>
            <atom:updated>2019-04-18T02:14:53.523Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ABoETEtEOKHvC00JenJ1yw.jpeg" /><figcaption>Credit: Christian Newman (Unsplash)</figcaption></figure><p>Too young to think</p><p>Too old to change</p><p>Too masculine to bend</p><p>Too feminine to blend</p><p>Too caring to be loved</p><p>Too loving to care for</p><p>Too good for you</p><p>Not bad enough for you</p><p>Ultimately I’m too young to matter,</p><p>but</p><p>you’re too old to bother — the words of one of my favorite artiste</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=50d996123d7e" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Dream]]></title>
            <link>https://medium.com/@cooProton/dream-7cb04b408553?source=rss-5d97add8fae6------2</link>
            <guid isPermaLink="false">https://medium.com/p/7cb04b408553</guid>
            <dc:creator><![CDATA[Bolaji]]></dc:creator>
            <pubDate>Mon, 25 Feb 2019 18:03:13 GMT</pubDate>
            <atom:updated>2019-02-25T18:03:13.091Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*OLbZSAUDU-HETJdMYGHIrA.jpeg" /></figure><p>Dream as if you will live forever. Live as if you will die today.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7cb04b408553" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Resetting your Postgres Database]]></title>
            <link>https://medium.com/backticks-tildes/resetting-your-postgres-database-f43ba9f1c601?source=rss-5d97add8fae6------2</link>
            <guid isPermaLink="false">https://medium.com/p/f43ba9f1c601</guid>
            <category><![CDATA[postgres]]></category>
            <dc:creator><![CDATA[Bolaji]]></dc:creator>
            <pubDate>Sat, 16 Feb 2019 12:27:49 GMT</pubDate>
            <atom:updated>2019-09-22T11:42:00.309Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/370/1*N8PzWF7yjXvqiDkdfs_5Eg.png" /></figure><p>I’ve been using a MacBook for about 2 years now and I honestly can’t count the number of times I’ve encountered this weird Postgres bug:</p><pre>psql: could not connect to server: Connection refused<br> Is the server running locally and accepting<br> connections on Unix domain socket &quot;/tmp/.s.PGSQL.5432&quot;?</pre><p>I’ve solved this quite a number of times but I usually never remember how I resolve it the next time I encounter it. I end up restarting my PC a number of times and having to stack overflow it over and over again.</p><p>Today, that changes, I’m going to write about it so I can always come back and check it whenever I run into this problem again.</p><p>This issue can be caused by a number of things but usually, it’s when you run brew update and you upgrade your Postgres version that this problem comes up. When this upgrade occurs, your Postgres config file is usually not compatible with the new one. To confirm what the problem is I advise you use this command:</p><pre>postgres -D /usr/local/var/postgres</pre><p>This command outputs the logs and you should see the cause of the issue. Here’s what the logs look like on my PC at the time of writing:</p><pre>2019-02-14 19:15:41.691 WAT [28825] FATAL:  database files are incompatible with server<br>2019-02-14 19:15:41.691 WAT [28825] DETAIL:  The data directory was initialized by PostgreSQL version 10, which is not compatible with this version 11.1.</pre><p>Usually, I don’t have production data or any important database on my PC, I instead have a back up for large dataset I use for testing. So I resolve to reset my PostgreSQL database because I don’t really mind losing the data.</p><p>Albeit if you would like to do this quickly with a three-liner and you’re fine with using the default Postgres user, here’s a quick solution— proposed to me by <a href="https://medium.com/u/66cca0a39af3">Dawuda Ebenezer</a>.</p><pre>$ postgres -D /usr/local/var/postgres</pre><pre>$ rm -rf /usr/local/var/postgres &amp;&amp; initdb /usr/local/var/postgres -E utf8</pre><pre># Then start the server:<br>$ pg_ctl -D /usr/local/var/postgres -l logfile start (the minor difference I think)</pre><p><strong>UPDATE</strong><br>Found an easier fix that might work for you, check it out here:</p><h3>Loki 💪 on Twitter</h3><p>Stop your postgres service with `brew services stop postgresql` - Move the .pid file in `/usr/local/var/postgres` to another location, just incase this fails lol - Start the postgres service again with `brew services start postgresql` All should be fine now.</p><h3>SOLUTION</h3><h4>CLEARING POSTGRES DATA FILES</h4><p>Let’s start by stopping the Postgres service with the command</p><pre>brew services stop postgresql</pre><p>Once this is done, you’d need to delete the data directory for PostgreSQL — L<strong>et me remind you that this is an irreversible action </strong>— if you aren’t sure, use the snippet below to back up the directory</p><pre>mv /usr/local/var/postgres/ /usr/local/var/postgres.backup</pre><p>You can do this with the snippet below to delete the Postgres data directory:</p><pre>rm -rf /usr/local/var/postgres/</pre><h4>RESETTING THE DATABASE</h4><p>Once this is done, you can create a brand new database with the command</p><pre>initdb /usr/local/var/postgres/</pre><p>After which you can start the PostgreSQL service with HomeBrew</p><pre>brew services start postgresql</pre><p>The action taken above clears all databases saved on the PC. So we need to get started by creating a user, this can be done by entering the PostgreSQL repl with the command:</p><pre>psql postgres</pre><p>Now, you should have a new repl instance similar to the screenshot below:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/604/1*3mxFj9-CgpAHcz8-VRoDtg.png" /></figure><p>We can then proceed to create a new user with the command</p><pre><strong>CREATE</strong> <strong>ROLE</strong> username <strong>WITH</strong> LOGIN <strong>PASSWORD</strong> &#39;quoted password&#39;;</pre><p>Remember to add the semi-colon at the end of the command, Postgres can act weird at times when the semi-colon isn’t there.</p><p>With the user created, you should be able to log into Postgres now with your credentials.</p><p>At this time, the only action we can perform is to log in, because no role has been assigned to the created user. Let’s proceed to assign the user a role, we do that with the command:</p><pre>ALTER ROLE username CREATEDB</pre><p>What we’ve done is simply give the created user the ability to create a database. There are other types of roles and you can assign a user multiple roles. The other role types include:</p><ul><li>SUPERUSER</li><li>CREATEROLE</li><li>CREATEDB</li><li>REPLICATION</li><li>BYPASS RLS</li></ul><p>Once you’re done assigning roles, you can go on with your day-to-day database activity.</p><p>I use <a href="https://eggerapps.at/postico/">Postico</a> for managing my Postgres databases — I personally love the simple and intuitive layout.</p><p>Now that the database user was created successfully, I can simply log into PostgreSQL using Postico and manage my database(s). A screenshot of what that looks like is shown below</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*TBEaDjG72ONrY9n4p5A9uA.png" /></figure><h3>UPDATE</h3><p>My solution to this problem is resetting my Postgres database because this mainly occurs in my dev environment which is my PC, albeit, if you would love to retain your data <a href="https://medium.com/u/74a04da5fa3a">Lawrence Wachira</a> has shared some info on how to go about it. Check the gist and screenshot below</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/842/1*XMJh9niS96qFExzCkWFXJw.png" /></figure><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/ade8378a5587425b7495859f0e48de17/href">https://medium.com/media/ade8378a5587425b7495859f0e48de17/href</a></iframe><p>I hope you enjoyed reading this article.</p><p>Alternatively, you can check this out:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*qrfE-DAv9mCyLw_wqwEvsQ.png" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f43ba9f1c601" width="1" height="1" alt=""><hr><p><a href="https://medium.com/backticks-tildes/resetting-your-postgres-database-f43ba9f1c601">Resetting your Postgres Database</a> was originally published in <a href="https://medium.com/backticks-tildes">Backticks &amp; Tildes</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>