Hacker News new | ask | show | jobs
by simoncion 3836 days ago
> ...I was somehow able to connect to the psql database...

Yeah? For posterity, mind detailing how did you do it?

> HN these days is full of elitist people who think the people who are struggling with things are downright dumb...

No. That's not what happened. You said:

> I have never been able to actually download install and use [Postgresql] ... unfortunately it isn't as simple as installing mysql[.]

Everyone who has installed both MySql and and Postgres know that you need to do exactly the same things [0] -albeit in slightly different ways to get started from scratch. Initial configuration of MySql and Postgres is equally complicated. [1] This makes your comment look like an anti-Postgres slam.

Cynical people might suspect that your original comment was the time-tested "Man, thing X sucks, can't do Y, and is completely useless!" Internet tech-support bait, but that ain't me, baby.

Over the years, I've found great profit in assuming that most widely-used non-B2B software [2] is actually generally well designed and thought-out, and that any inability to do a thing is a result of my lack of understanding or familiarity rather than poor or difficult design of the software. Why? Because, -frankly- such failures are pretty much always a result of my lack of understanding.

[0] Configure listen IP, create a superuser account, set database access permissions, create a database, start the daemon.

[1] That is, (compared to writing software that uses SQL) not complicated at all, and just as complicated as configuring any other non-trivial daemon.

[2] And some B2B software, too.

1 comments

Hmm I guess so everyone thought that I was the troll who just hates X because Y reason!!

I did a sudo -u suraj createdb mydb

It said that role suraj didn't exist, then I realized that postgres was using my own username, I didn't touch a single config file! In a remarkable sense of irony, postgres is so amazing that while installation mysql needs us to give a password, postgres uses this user concept and for each database you have to create a new user so there is no one password to rule them all.

$ sudo -u suraj psql

I was just trying to do

$ psql

then it was saying that the role suraj didn't exist

so I did sudo -u postgres createuser --superuser $USER

then it said that role suraj exists, then it said database suraj didn't exist

sudo -u suraj createdb amarokdb;

then it created the db

then

I connected the db using the usual format

> ...postgres is so amazing that while installation mysql needs us to give a password...

If you install Mysql from scratch, you also need to manually set the superuser password.

For a different perspective, read the relevant post-installation configuration documentation for Mysql [0] and Postgresql [1] on Gentoo Linux.

If your distro asks you -as part of the installation process- for a MySQL password, that's a feature that has been added by the MySQL packager for your distro, not a feature of MySQL.

> postgres uses this user concept and for each database you have to create a new user so there is no one password to rule them all.

This is completely incorrect. Look at pg_hba.conf and the comments contained within, as well as the GRANT command I mentioned in an earlier comment.

A suggestion:

Slow down. Block out an hour or two to learn how to properly manage both a Postgres and a MySql server.

Figure out that Postgres calls "Users" "Roles" (because a Role can be one or more users). Read about Database Role management in the official Postgres documentation. Learn about Roles and Role permission management. Do the same for MySQL.

Once you've done this you will

* Be able to manage DB user accounts and permissions without depending on random internet walkthroughs.

* Understand that -despite the terminology differences- managing users and DB permissions is fundamentally the same in MySQL and Postgres.

[0] https://wiki.gentoo.org/wiki/MySQL/Startup_Guide#MySQL_Insta...

[1] https://wiki.gentoo.org/wiki/PostgreSQL/QuickStart#Starting_...

hey I downloaded the postgres documentation and begun reading it, thank you very much for your guidance!
Happy reading, dude.

FWIW, I've found the Postgres documentation to be a little less easy for a novice to wrap their head around, but substantially higher quality than the MySQL documentation. Just remember that the Postgres documentation has sections that are purely reference material and sections that are mostly tutorials.

When in doubt, play around and make notes on what you did so when you accidentally burn it all down you can remember to not do the same thing twice. ;)