I forgot the semicolon ";" in a MySQL Terminal query. How do I exit?

Just type \c to clear the current input statement


You are unaware of the 5 different quote modes of the mysql terminal. I suggest you review them:

https://dev.mysql.com/doc/refman/5.0/en/entering-queries.html

Relevant parts of the above link:

The following table shows each of the prompts you may see and summarizes what they mean about the state that mysql is in.

Prompt  Meaning
mysql>  Ready for new command.

->      Waiting for next line of multiple-line command.

'>      Waiting for next line, waiting for completion of a string 
        that began with a single quote (“'”).

">      Waiting for next line, waiting for completion of a string 
        that began with a double quote (“"”).

`>      Waiting for next line, waiting for completion of an 
        identifier that began with a backtick (“`”).

/*>     Waiting for next line, waiting for completion of a 
        comment that began with /*.

In the MySQL 5.0 series, the /*> prompt was implemented in MySQL 5.0.6.

Multiple-line statements commonly occur by accident when you intend to issue a command on a single line, but forget the terminating semicolon. In this case, mysql waits for more input:

mysql> SELECT USER()
    ->

If this happens to you (you think you've entered a statement but the only response is a -> prompt), most likely mysql is waiting for the semicolon. If you don't notice what the prompt is telling you, you might sit there for a while before realizing what you need to do. Enter a semicolon to complete the statement, and mysql executes it:

TLDR:

To exit, type \c, ;, ctrl-c or ctrl-d. If all of those fail, get out of the quote mode you are in by typing '<enter>, "<enter>, or */<enter>