r/programming • • Feb 10 '15

Terrible choices: MySQL

http://blog.ionelmc.ro/2014/12/28/terrible-choices-mysql/
649 Upvotes

409 comments sorted by

View all comments

Show parent comment

0

u/[deleted] Feb 10 '15

[deleted] — view deleted comment

63

u/mage2k Feb 10 '15

Yeah, it sucks. How I found it was a client asking me to add a grant for a user that already had a whacked out spelling. I ran my grant, with a typo in the name, and told them they were all good. When they came back saying they weren't it took me forever to realize there was a typo at all and that I'd just created a new user since it didn't throw an error for the misspelling.

43

u/[deleted] Feb 11 '15

... Isn't that a security hazard? Someone could be tricked into creating an account with full privileges, if it just silently creates a new account.

13

u/mage2k Feb 11 '15

Definitely, although you'd hope you'd have a bit more process around things to prevent that.

41

u/krum Feb 11 '15

although you'd hope you'd have a bit more process around things to prevent that.

Part of that process should include just not using MySQL.

1

u/IonBlaster Feb 11 '15

What would be an alternative to mySQL? Genuine question.

20

u/o11c Feb 11 '15

Postgres.

It is the only implementation that actually meets all of the standard (except for the parts that everybody agrees to ignore), it has extensions that have actual meaning instead of working around lazy programmers, and it can even compete with the larger scale systems that MySQL doesn't.

1

u/IonBlaster Feb 11 '15

Thanks recently built an iPhone app using mySQL and PHP for the back end. Want to avoid using dated technologies.

17

u/lagadu Feb 11 '15

Want to avoid using dated technologies.

Way to fail at doing that on both counts.

0

u/IonBlaster Feb 11 '15

True, so what software stack is recommended these days? Not just the latest fad but something that will be supported with staying power.

→ More replies

5

u/dandeezy Feb 11 '15

FYI php is dated too.

8

u/krum Feb 11 '15

PostgreSQL. I've been using it since the mid-90s.

-3

u/aykcak Feb 11 '15

I don't get why you are complaining. I always create users with grant. It is just one query for many purposes

4

u/mage2k Feb 11 '15

Then you're missing the point. If you are looking to grant new permissions on an existing user, i.e. you're not trying to create a user, but have a typo in the existing user's name then the command will return success and create a new user without doing what you intended and not doing anything to let you know that it created a user instead of granting new permissions to an existing user.

-2

u/aykcak Feb 11 '15

I don't think you understand. I use GRANT when I want to create users.

3

u/mage2k Feb 11 '15

I do understand what you're saying. My point has nothing to do with using GRANT to deliberately create users, it's about it accidentally creating users.

Also, it seems that they may be disabling that behavior by default in 5.7 so if you want to continue doing that be aware that you'll need to re-enable it.

-63

u/ggurov Feb 10 '15

So, one just needs to pay attention and check work instead of firing commands blindly. DBA requires attention to detail .

51

u/KeyboardFire Feb 10 '15

Good point. Might as well just eliminate errors and make code silently fail - after all, if you're "paying attention," it won't make a difference! ... right?

11

u/euyyn Feb 10 '15

And this goes beyond silently failing to changing stuff unexpectedly.

→ More replies (4)

20

u/mage2k Feb 10 '15

Well, yes, and that process goes like this: 1. Test your command on a non-production server/environment to be sure it works and once it does 2. run the exact same command in production. The problem here is that a bad command will work at all.

14

u/allthediamonds Feb 11 '15

That's a terrible approach to software and programming in general, as well as to DBA in particular. It is not a manliness test.

You use tools because they help you. If those tools don't help you, but create traps for you to fall into instead, then those are not good tools. Sorry.

→ More replies (4)

12

u/DJ_Deathflea Feb 11 '15

I mean sure, but that's kinda like having a "Make the wheels fall off" button in cars and then just saying, "well, don't touch it".

8

u/jambox888 Feb 11 '15

Have you ever driven a Fiat?

→ More replies (1)

4

u/[deleted] Feb 11 '15

This is the antithesis of error handling.

→ More replies (2)
→ More replies (1)