When you’re inside the
mysql command line client, trying to clear the console using the
clear command won’t work.
This is because
clear is a system shell command that’s unrecognized by
mysql> clear # nothing happens...
To clear the console, you need to add the
\! symbol before the
\! symbol can be used in
mysql client to execute a system shell command. The syntax is as shown below,
When you’re in a Unix-like OS like Linux or macOS, you can clear the
mysql console screen with the following command,
mysql> \! clear # clears the mysql console screen
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
Here’s an example of clearing the screen for Windows Command Prompt. Click the image to open it in a new tab
Thank you for reading, If you have reached so far, please like the article, It will encourage me to write more such articles. Do share your valuable suggestions, I appreciate your honest feedback!