How can I be sure that a query was not executed?

For example, I try to execute

update `table` set `a`='b' 

and got the error 2006 server has gone away

| improve this question | | | | |
  • If you're worried about this, use transactions. – ceejayoz Mar 6 '19 at 23:03
  • SELECT COUNT(DISTINCT a), COUNT(*) FROM table; to determine current DISTINCT number of values in your a column and total row count – Wilson Hauck Mar 10 '19 at 19:19

Don't run the SQL statement :-)

If you want the mysql client to stop you running it, there is a --safe-updates aka --i-am-a-dummy option.

If you want the server to rollback, use innodb tables that provide transactional support.

For the error see gone away.

| improve this answer | | | | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.