3 ms·
FWIW: Setting "safe-updates=1" in ~/.my.cnf will require UPDATE and DELETE statements in the client to have a WHERE clause which references a key. It's not perf
by duskwuff 10y ago
FWIW: Setting "safe-updates=1" in ~/.my.cnf will require UPDATE and DELETE statements in the client to have a WHERE clause which references a key. It's not perfect protection, but it will save you from a lot of mistakes.
- gigatexal 10y agohmm, that's kinda cool. I'm in a MS shop and I don't know if SMSS has the same feature. My manager just looked at me and said "welp, go restore the table and be more careful next time." I was a new DBA at the time, still, kinda new.
- amichal 10y agoThat's awesome, My worst DELETE fail however was: DELETE * FROM table WHERE [long condition that resolves to true for all records] Now i write SELECT or SELECT COUNT(*) over and over again until i see the data i expect and then change it to a DELETE/UPDATE. It's not my personal habit but some folks I know turn off auto commit and BEGIN a transaction every time they enter an interactive SQL sessions. They then default to ROLLBACK at least once before COMMITing them. That and having a user with read-only permissions or a read replica
- tacon 10y agoIs there a collection of data safety tips like this somewhere? I never knew this existed. What else am I missing?