Hacker News new | ask | show | jobs
by cess11 492 days ago
MySQL 5 had bad defaults. Some would probably argue that hooking into sudo rather than a dedicated databaser user amounts to one. MySQL is also perceived by some to be a software for amateurs.

Unless you need the kind of sophisticated extensions Postgres supports MySQL is likely to be a good fit. The query planner is straightforward, performance tuning slightly more predictable and easy compared to Postgres.

2 comments

MySQL is more user friendly. Examples are, autoincrement vs postgres sequences, case sensitivity, users ans databases are straightforward on mysql vs roles, dbs and schemas on postgres. Replications are also easy to setup on mysql.
> Some would probably argue that hooking into sudo rather than a dedicated databaser user amounts to one

What are you referring to here?

Postgres is administered through a postgres user.
Sure, and MySQL is administered through a mysql user.

When people talk about bad defaults in old MySQL, they're typically referring to lack of strict sql_mode by default prior to MySQL 5.7 (2015). They're not talking about OS users.

I've been using MySQL for 22 years and your comment about sudo bears no resemblance to anything I've ever experienced.

Not in my experience. It might run as a mysql user but I can't remember having su:d to it. Maybe you can give some examples of administration that require you to?

Collations and charsets and the DB engine and other stuff wasn't particularly good either, but I can't be arsed to figure out specifically when so I glossed over the details. I don't think it matters. 8 is what, a decade old or so?

> Maybe you can give some examples of administration that require you to?

That require you to what? Nothing in MySQL inherently requires sudo or involves "hooking into sudo".

The mysql server daemon (mysqld) typically runs as mysql:mysql, with directories owned by mysql:mysql in the Unix permission model, but this is all entirely dependent on how you have installed it.

Inside the database server, you can freely configure database users, which are entirely separate from the notion of OS users. Although the default superuser in MySQL is typically called "root", it can be called anything, and is not tied to the OS root user.

Connecting to MySQL can be done either via tcp/ip or locally through a Unix domain socket; this is all completely configurable on a per-database-user level inside the database itself.

When connecting over the local Unix domain socket, connections are permitted if the requested user name has a database user entry with @localhost for the host portion.

I suppose your OS user is relevant in two ways when using the local Unix domain socket:

* You need OS permissions to interact with the socket. That's the case with any Unix domain socket, not MySQL specific.

* If you're using the standard `mysql` command-line client and you haven't supplied a database user name for the connection, your OS user name will be used as a default.

So perhaps you were running `sudo mysql ...` to connect to the local mysqld because your OS user lacked the :mysql group to interact with the socket; or because your OS user did not have a corresponding database user/grants inside the database. In the latter case, you can just type `mysql -u root ...` instead to specify what database user to connect as. There's literally nothing requiring sudo in that case.

That said, you can optionally make this passwordless using the auth_socket auth plugin, in which case there are extra considerations around having the users match and maybe that's what happened to you. But there's no requirement to use that passwordless auth_socket approach for administration.

> Collations and charsets and the DB engine and other stuff wasn't particularly good either,

That's quite vague and it sounds like you aren't well-informed about MySQL in general so I suppose there's little sense in diving into it.

> I don't think it matters. 8 is what, a decade old or so?

MySQL 8.0 came out less than seven years ago, but that's irrelevant since everything I described above regarding permissions is equally true in MySQL 8.0.

None of this describes a su to the mysql user.

What's your experience with Postgres?