[mysql] How to clear mysql screen console in windows?

The title is my question. I googled and try something like

mysql> !\ clear
mysql> !\ cls
mysql> system cls
mysql> system clear 

blah blah ...

but none of them works. anyone show me how to clear screen, just like cls command in window

This question is related to mysql windows command-line sqlcommand

The answer is


For windows command prompt

Use

system cls

For Window 10

Use the command system cls and this will clear the MYSQL Command Line window in Windows


The bug on Windows which most people are talking is probably fixed. Ctrl + L is works for clearing the screen on Windows 10 [Mysql 8]


mysql> 
root@xion:~# mysql -uroot -ppassword;
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 33291
Server version: 5.0.51a-3ubuntu5.4 (Ubuntu)

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql> \! clear

It worked for me using this:

clear screen

just type \system cls

took me a couple hours to get it jejej


I used the command line client prompt and to clear the screen I typed:-

system cls


Unfortunately in Windows, It is not possible. The only way out is to exit and type cls and then again open mySQL


This is what I did to get around this bug. The windows console (cmd) is just not worth using for anything other than some simple commands. So the following is what I did.

Installed Cygwin (Go here) It is pretty straight forward to install. You can watch this video. It explains very easily how to install cygwin. Make sure when you select the packages that you want to install includes Mintt (it is basically a better shell or cmd) and mysql client package.

Once you are done installing it, you should add the bin folder from cygwin in your PATH Environmental Variables(The above video explains that as well)

Now You will have an icon on the desktop for cygwin. Open it up and login to mysql using the normal commands. You will need to put the ip of the mysql server in the command to make it work. I use the following logging in MySQL which was installed through wamp

mysql -u root -p -h 127.0.0.1 

You can add more arguments in there if you want. Once you get in mysql just press ctrl + L and you will clear the screen.


Fixed in 8.0.19.

Previously, the system (!) command for the mysql command-line client worked only for Unix and Unix-like systems. It now works on Windows as well. For example, system cls or ! cls may be used to clear the screen.


although there is bug for clearing the screen in MySQL, I have found one tactic trick whatever you want to say...

you can easily clear the screen using this...

just press ( ctrl + down arrow ) until you reach to top... happy codding...


Just scroll down with your mouse

In Linux Ctrl+L will do but if your scroll up you will see the old commands

So I would suggest scrolling down in windows using mouse


EDIT:
I don't think Any of the commands will work. In linux Ctrl-L will do the job. in windows there is no equivalent. You can only Exit MySql, Type CLS and then re-enter MySql.


Well, if you installed MySql Server e.g. Version 5.5. which has it's folder located in:

C:\Program Files\MySQL\MySQL Server 5.5\bin

The best way would be to include it in your paths.

  • First run sysdm.cpl applet from run i.e. WinKey + R

  • Navigate to Advanced -> Environment Variables

  • Select PATH and Click Edit.

  • Scroll to the end of the text, and add ";C:\Program Files\MySQL\MySQL Server 5.5\bin" without quotes (Notice the semicolon starting the text, this should only be added if it's not already there),

Now you can just call:

start /b /wait mysql -u root -p

via command prompt.

To clear the screen now, you can just exit in mysql & call cls

Kinda trickish hack but does the job.

If you're using WAMP or other tool, it's even easier!

Open command prompt and type:

C:\wamp\mysql\bin\mysql -u root -p

Enter as normal, then whenever you want to clear screen, do:

exit or quit

And then clear using DOS:

cls

You can easily re-enter by pressing up twice to get your mysql call command


I had the same issue, and CTRL+L worked for me on Windows 10.


mysql console can cleared out on windows by using shortcut key

CTRL + L


On linux : you can use ctrl + L or type command system clear.


Click with contextMenu button on Mysql prompt and choose "Scroll", because I didn't find any way to clean too. =P


you can type the following step:

mysql> exit;

C:\xampp\mysql\bin> cls

C:\xampp\mysql\bin> mysql -u root -h localhost

it's work!


You are typing the command wrong. It is "\" before "!" and not after. The command ctrl+L will not work for windows. To clear mysql console screen, type following command.

mysql> \! cls

This will do the job for windows. "\!" is used to execute system shell command. "cls" is command to clear windows command prompt screen. Similarly if you are on linux, you will type "ctrl+L" or following,

mysql> \! clear

source: https://dev.mysql.com/doc/refman/8.0/en/mysql-commands.html


I handle it as follows:

  1. Right click on cmd open property's goto layout
  2. Set screen buffer height to 9999 and ok
  3. Now whenever you want to type a new query, just scroll with the mouse and you will get a blank screen

SQL> clear scr

This command clears the screen in MYSQL


Open Properties by clicking the upper left console window icon, go to Layout tab, take note of the value set in Screen Buffer Size->Height, and change it to 1. Click OK.
You'll see a 1 row console. Open Properties again and change that value back to what it had before. Resize the console down and you'll have a clean console.

enter image description here


Examples related to mysql

Implement specialization in ER diagram How to post query parameters with Axios? PHP with MySQL 8.0+ error: The server requested authentication method unknown to the client Loading class `com.mysql.jdbc.Driver'. This is deprecated. The new driver class is `com.mysql.cj.jdbc.Driver' phpMyAdmin - Error > Incorrect format parameter? Authentication plugin 'caching_sha2_password' is not supported How to resolve Unable to load authentication plugin 'caching_sha2_password' issue Connection Java-MySql : Public Key Retrieval is not allowed How to grant all privileges to root user in MySQL 8.0 MySQL 8.0 - Client does not support authentication protocol requested by server; consider upgrading MySQL client

Examples related to windows

"Permission Denied" trying to run Python on Windows 10 A fatal error occurred while creating a TLS client credential. The internal error state is 10013 How to install OpenJDK 11 on Windows? I can't install pyaudio on Windows? How to solve "error: Microsoft Visual C++ 14.0 is required."? git clone: Authentication failed for <URL> How to avoid the "Windows Defender SmartScreen prevented an unrecognized app from starting warning" XCOPY: Overwrite all without prompt in BATCH Laravel 5 show ErrorException file_put_contents failed to open stream: No such file or directory how to open Jupyter notebook in chrome on windows Tensorflow import error: No module named 'tensorflow'

Examples related to command-line

Git is not working after macOS Update (xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools) Flutter command not found Angular - ng: command not found how to run python files in windows command prompt? How to run .NET Core console app from the command line Copy Paste in Bash on Ubuntu on Windows How to find which version of TensorFlow is installed in my system? How to install JQ on Mac by command-line? Python not working in the command line of git bash Run function in script from command line (Node JS)

Examples related to sqlcommand

Check if a record exists in the database How to run multiple SQL commands in a single SQL connection? Insert into C# with SQLCommand How to export and import a .sql file from command line with options? How to clear mysql screen console in windows? Timeout expired. The timeout period elapsed prior to completion of the operation or the server is not responding. The statement has been terminated How to pass table value parameters to stored procedure from .net code