Don't forget the root password

Don't forget the root password

Nov 20, 2021

Last night I was installing the latest version of postgreSQL on my local machine. It's a Windows laptop that I mainly use as my .NET development machine. Which means SQL Server for the most part.

I'm currently working on a new project however that will be based around Node.js and React. So I'm deciding to go with postgreSQL this time around as there is plentiful documentation relating to the PERN stack right now.

  • PostgreSQL

  • Express.js

  • React

  • Node.js

After double-clicking on the installer, I was alerted that I already had Postgres installed. More than likely I installed it months ago just to check it out and I probably completely forgot about it.

So I fired up DBeaver, the free universal database tool, and I tried to connect to my local Postgres server.

I left all connection fields alone to their default values and clicked on the "test connection" button. As expected, I needed some form of password for this server. I don't recall ever having to type in this password, but it had been months since the install. So I probably did and forgot.

I did what any good developer would do, and I Googled it. Lo and behold, alot of people had the same issue. As it turns out, changing the root password on an administrator account to a database server is not an easy task. And that's a good thing, because security is important.

Most of what I found were quick hacks that involved modifications to internal configuration files, in the hopes of triggering some kind of "change password" event. I was pretty unsure about the whole thing, but I went ahead and tried the suggestions.

Don't be shocked when I tell you, that nothing happened. "Fatal log in error" was the only response that I received back over and over again.

PGAdmin is the official admin tool for PostgreSQL. So I downloaded it and fired it up in the hopes that I would find something useful. Which I kind of did. It requested a root Admin password the first time that I fired it up. That password, however, was not the server password.

And when I attempted to scrap the default server and to make a new one, I got the same password fatal error that I had received early on. So I couldn't delete the old server and I couldn't create a new one either.

More Googling later and I was ready to scrap the whole thing and go back tor SQL Server where things made more sense. But instead I decided to do a clean uninstall and tried again.

Wouldn't you know it that after installation, there was a prompt that appeared asking me for a default password and to not forget it, because there would be no way to recover it. I made note of it and will get to writing it down eventually one day.

So lesson for the day (if you want to save hours of troubleshooting later), don't forget your databases default root passwords. Servers are pretty secure these days and even if you are on the local machine, that does not guarantee you access.

Enjoy this post?

Buy ThatSoftwareDude a coffee

More from ThatSoftwareDude