Home Blogs How to clear MySQL console screen

How to clear MySQL console screen

by Anup Maurya
9 minutes read
Clear MySQL console screen in Command Prompt

In this article, you’ll learn How to clear MySQL console screen. 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 client:

mysql> clear
# nothing happens...

To clear the console, you need to add the \! symbol before the clear command.

The \! symbol can be used in mysql client to execute a system shell command. The syntax is as shown below,

\! shell-command

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 cls command.

Here’s an example of clearing the screen for Windows Command Prompt. Click the image to open it in a new tab

Clear MySQL console screen in Command Prompt
Clear MySQL console screen in Command Prompt

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!

related posts

1 comment

Saurabh Singh December 6, 2022 - 2:39 pm

Great share

Reply

Leave a Comment

Enable Notifications OK No thanks