How to Clear Screen in MySQL
If you have found yourself on this page it is probably because you are looking for an easier way to do things. You are probably wondering how to clear the screen in MySQL. This may be very easy or a bit difficult depending on which operating system and version you are using. We are going to cover Linux/Unix, Windows, and OSX.
How to clear the screen in MySQL:
mysql> !\ clear
mysql> !\ cls
mysql> system cls
mysql> system clear
Linux
If you are running Linux this should be pretty easy. The above commands should all work fine but you should also be able to use the following key combo.
[ctrl] + l |
Windows
There was an issue with clearing the screen for a long time when running on Windows. This has apparently been fixed as of version 8.0.19
Here is a quick description of the issue and the work around which shouldn’t be a problem anymore on more recent versions of MySQL:
On Windows it is a bit harder. Apparently the commands to clear the screen don’t work. This is related to the following bug: MySQL Windows Bug As a work around it has been suggested that a user could exit the MySQL CLI, run the cls command, and then re-run the CLI.
Mac OSX
On OSX you should also be able to use any of the following depending on your version of the terminal application. The normal MySQL CLI commands from above should also work.
Clear from the menu:
- Edit > Clear Screen
- Edit > Clear Buffer or
These key combos:
⌥ + CMD + L |
CMD+K |