How to clear MySQL screen console in Windows?
Asked Answered
S

30

68

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 Windows?

Soulsearching answered 10/1, 2012 at 17:42 Comment(3)
Hi friend can you try this [link] (dev.mysql.com/doc/refman/5.0/en/mysql-commands.html), so that this might help youInsolation
system clear works nowApprehension
For Windows 11 on PowerShell running MySQL 8, system cls is work Fine.Disrupt
L
39

This is not possible on Windows.

There is an open bug for this issue: Bug #58680: Windows Clear Screen Command

Lapwing answered 10/1, 2012 at 17:49 Comment(4)
In linux Ctrl-L will worked fine but for window there is no any option.Chromato
They are probably in no rush to fix it, since Linux users usually look down their noses at Windows users, whom they perceive as second class citizens.Ketonuria
This is not a fix but pressing Enter until I get the cursor down eases my mind.Retirement
"system cls" clears the MySQL screen on PowerShell 7.Honourable
E
62

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 the following command:

mysql> \! cls

Explanation:

  • \! is used to execute system shell commands
  • cls is a command to clear the Windows command prompt screen

This will do the job for Windows.


Similarly if you are on Linux, you will type Ctrl+L or the following:

mysql> \! clear

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

Escallop answered 24/10, 2020 at 5:29 Comment(3)
Works with "\! cls" in Windows 10, thank you!Backbend
this answer is working fine in Windows 10. Commenting just for helping purpose.Expatriate
also works on ubuntu - if anyone is interestedHenriquez
P
52

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 console by executing quit, execute cls and then re-enter MySQL console.

Pharsalus answered 10/1, 2012 at 17:48 Comment(0)
L
39

This is not possible on Windows.

There is an open bug for this issue: Bug #58680: Windows Clear Screen Command

Lapwing answered 10/1, 2012 at 17:49 Comment(4)
In linux Ctrl-L will worked fine but for window there is no any option.Chromato
They are probably in no rush to fix it, since Linux users usually look down their noses at Windows users, whom they perceive as second class citizens.Ketonuria
This is not a fix but pressing Enter until I get the cursor down eases my mind.Retirement
"system cls" clears the MySQL screen on PowerShell 7.Honourable
S
36
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
Steroid answered 15/6, 2013 at 11:5 Comment(0)
C
11

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

Crosswind answered 3/11, 2015 at 1:44 Comment(1)
It works also for windows PowerShellDisbud
I
9

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

Inapplicable answered 30/8, 2017 at 7:20 Comment(0)
G
5

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

Gaily answered 25/1, 2015 at 11:32 Comment(0)
H
4

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.

Helsie answered 29/11, 2013 at 1:37 Comment(0)
A
4

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

Aquilegia answered 18/6, 2019 at 6:52 Comment(2)
This works for me (MySQL console in Cmder on Windows 10)Nitroparaffin
you can Use the command system cls and this will clear the MYSQL Command Line window in WindowsRagg
L
4

mysql console can cleared out on windows by using shortcut key

CTRL + L

Lustig answered 8/4, 2020 at 15:17 Comment(0)
M
3

For windows user just type system cls;

Note don't forgot to add semicolon ; at the last.

enter image description here

Meander answered 21/2, 2022 at 14:12 Comment(0)
S
3

Yes, you can clear the screen no matter whether you're using Command line Client or any Linux Terminal

We're using cls in cmd and clear in terminal to clear the screen.
Command line client and Terminal accepts the same command with either system or \! flag.
Both commands listed below are valid!

Command Line Client:

system cls
\! cls

For Terminal:

system clear;
\! clear;

Other commands can be found here for MySql Command Line Client
Change the version number form the top right corner on the website.

Sepia answered 27/2, 2022 at 10:7 Comment(0)
H
2

just type \system cls

took me a couple hours to get it jejej

Hoag answered 25/1, 2021 at 2:15 Comment(0)
K
1

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

Kissinger answered 1/8, 2012 at 14:18 Comment(0)
S
1

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!

Schlesien answered 19/9, 2015 at 4:20 Comment(0)
F
1

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
Flimsy answered 6/10, 2015 at 1:9 Comment(0)
F
1

SQL> clear scr

This command clears the screen in MYSQL

Fourgon answered 29/5, 2018 at 5:35 Comment(0)
G
1

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

Goodkin answered 5/5, 2020 at 7:21 Comment(0)
A
1

It worked for me using this:

clear screen
Arellano answered 22/5, 2020 at 0:41 Comment(0)
I
1

For windows command prompt

Use

system cls
Iterate answered 12/6, 2020 at 2:13 Comment(0)
C
1

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]

Controvert answered 9/7, 2020 at 10:4 Comment(0)
C
0

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

Crucible answered 28/1, 2016 at 10:15 Comment(0)
L
0

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.

Lek answered 4/7, 2020 at 0:19 Comment(0)
D
0

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

system cls

Denoting answered 27/9, 2020 at 14:25 Comment(2)
add a short explanation why this answer is better or how this works. it makes answers better.Alterant
My possible explanation would be that I tried running all others including ctrl+L but it didn't work.Denoting
R
0

For Window 10

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

Ragg answered 3/12, 2020 at 6:47 Comment(0)
K
0

As of 26 July, 2019. This issue has been fixed.

Use can either of them with out without semicolon to clear mysql console on windows.

  1. system cls

  2. \! cls

Source: Bug #58680 Windows Clear Screen Command

Kreda answered 21/10, 2022 at 10:15 Comment(0)
A
0

This one worked for me

system cls;
Apologia answered 12/1 at 8:47 Comment(1)
This answer has been posted at least five other times on this same question. Adding more to the pile doesn't really help.Jillian
G
0

Adding to other answers the Ctrl+L command still works in regular Windows Terminal using PowerShell, when using mysql.exe as well as in MySQL Shell the specialised Shell from MySQL. Tested both in Windows 11 and both work.
The following with \system switch could also be used in MySQL Shell to run underlying operating system (Windows 11 in our case) commands, in case Ctrl+L is bound to a specific command in Windows Terminal:

\system cls

SQL Shell in Windows Terminal inside Windows 11

But for most users Ctrl+L should still work.

Gauge answered 23/4 at 13:55 Comment(0)
P
0

For mysql shell for VSCODE use CRTL + A to select everything then hit backspace to delete history.

Paradise answered 17/5 at 8:30 Comment(0)
G
-1

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

Gymnastic answered 16/9, 2015 at 3:6 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.