Today I learned about an interesting command-line option for MySQL:
$ mysql --i-am-a-dummy
This is an alias for
--safe-updates, which imposes three restrictions:
- Any UPDATE or DELETE that does not have a WHERE or LIMIT is rejected.
- Any SELECT without a LIMIT will be automatically limited to 1,000 rows in the result.
- Any join that would result in examining more than a million row combinations is rejected.
I thought it was funny at first, but the first restriction alone makes this useful for doing work on the command-line on live servers. You ever intend to do something like
DELETE FROM users WHERE id = … and you forget that tiny little where-clause? Because I have, and all you want to do is hide under your desk, under the assumption that if no one can see you then you must be invisible.