1

How unsafe is to use ctrl + c when in mysql prompt whether to interrupt a hanging statement or ctrl + d to exit?

When I do ctr + d for exit mysql can see a ¿special character? typed besides Bye

mysql> ^DBye

Doing ctrl + c for exit mysql

mysql> Ctrl-C -- exit!
Aborted

Doing ctrl + c to cancel or interrupt a query with a huge row impression

mysql> SELECT * FROM db.table ORDER BY column DESC;
........
........
........
........
Ctrl-C -- sending "KILL QUERY 126537" to server ...
Ctrl-C -- query aborted.

But when trying to re-execute an improved query

mysql> SELECT * FROM db.table ORDER BY column DESC LIMIT 10;
ERROR 1317 (70100): Query execution was interrupted

Need to execute again and no error's returned.

I want to know if there's some security or safety stuff related to this.

  • More details, please. – Rick James Jul 19 '16 at 22:23
  • @RickJames updated – tachomi Jul 19 '16 at 22:42
  • ^C aborts the query, as you see. ^D is "end-of-file", which terminates the commandline mysql (but not the server, mysqld). – Rick James Jul 20 '16 at 0:36
  • 1
    ORDER BY will take a long time if there are millions of rows. The ORDER BY must finish before LIMIT can take effect, so the query takes time with or without the LIMIT. – Rick James Jul 20 '16 at 0:37
  • 3
    I use ^C a lot; it is "harmless" on SELECTs. – Rick James Jul 20 '16 at 0:38

Your Answer

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

Browse other questions tagged or ask your own question.