Suppose you're typing a command line query into a MySQL database and you need to cancel out and start over. From a bash shell you could just type ctrl-c and get a new prompt. In MySQL, ctrl-c would exit the client and return you to the shell.
For example, I have a long, complex SELECT statement typed in but I haven't yet hit return. I realize that I don't want to send the command but I want to have the command on-screen so I can use it as a reference. I'd like to bail out without quitting MySQL. Any ideas?
Key point: the command hasn't yet been executed.
To clear the console, you need to add the \! symbol before the clear command. Alternatively, you can also use the CTRL + L command to clear the screen. If you're accessing MySQL from the Command Prompt in Windows OS, then you need to replace the clear command with the cls command.
The Clear command clears the screen of the SQL*Plus application window and the screen buffer. Shift+Del is the keyboard shortcut for the Clear command.
Use either of these keyboard shortcuts: Ctrl+C or Ctrl+D . These can be used to instantly exit any program that is running within a command prompt.
Type \c
.
When you start up MySQL, you'll likely see this message:
Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
The "buffer" that it's referring to is the command/query buffer.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With