如何在 Windows 中清除 MySQL 屏幕控制台?
标题就是我的问题。我用谷歌搜索并尝试了类似的方法
mysql> !\ clear
mysql> !\ cls
mysql> system cls
mysql> system clear
blah blah ...
,但没有一个有效。
有人告诉我如何清除屏幕,就像 Windows 中的 cls 命令一样吗?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(29)
您输入的命令错误。它是
\
在!
之前而不是之后。命令 Ctrl+L 不适用于 Windows。要清除 MySQL 控制台屏幕,请键入以下命令:
说明:
\!
用于执行系统 shell 命令cls
是清除 MySQL 控制台屏幕的命令。 Windows 命令提示符屏幕这将完成 Windows 的工作。
同样,如果您使用的是 Linux,您将输入 Ctrl+L 或以下内容:
来源:https://dev.mysql.com/doc/refman/8.0/en/mysql-commands.html
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:
Explanation:
\!
is used to execute system shell commandscls
is a command to clear the Windows command prompt screenThis will do the job for Windows.
Similarly if you are on Linux, you will type Ctrl+L or the following:
Source: https://dev.mysql.com/doc/refman/8.0/en/mysql-commands.html
我认为任何命令都不起作用。
在 Linux 中 Ctrl+L 即可完成此工作。在 Windows 中没有等效的。您只能通过执行
quit
退出MySQL控制台,执行cls
,然后重新进入MySQL控制台。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
, executecls
and then re-enter MySQL console.这在 Windows 上是不可能的。
此问题有一个未解决的错误:Bug #58680:Windows Clear Screen Command
This is not possible on Windows.
There is an open bug for this issue: Bug #58680: Windows Clear Screen Command
只需用鼠标向下滚动
在 Linux 中 Ctrl+L 就可以了,但是如果向上滚动,您将看到旧命令
所以我建议在 Windows 中使用鼠标向下滚动
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
在 Linux 上:您可以使用 ctrl + L 或键入命令
systemclear
。On linux : you can use ctrl + L or type command
system clear
.虽然 MySQL 中存在清除屏幕的错误,但我发现了一种战术技巧,无论你想说什么......
你可以使用它轻松地清除屏幕......
只需按( ctrl + 向下箭头)直到到达顶部。 ..快乐编码...
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...
这就是我为解决这个错误所做的事情。除了一些简单的命令之外,Windows 控制台 (cmd) 不值得使用。所以以下就是我所做的。
已安装 Cygwin(前往此处)安装非常简单。您可以观看此视频。它非常简单地解释了如何安装 cygwin。确保当您选择要安装的软件包时包括 Mintt(它基本上是一个更好的 shell 或 cmd)和 mysql 客户端软件包。
安装完成后,您应该将 cygwin 中的 bin 文件夹添加到 PATH 环境变量中(上面的视频也解释了这一点)
现在您将在桌面上看到 cygwin 的图标。打开它并使用普通命令登录 mysql。您需要将 mysql 服务器的 IP 放入命令中才能使其工作。我在通过 wamp 安装的 MySQL 中使用以下日志记录,
如果需要,您可以在其中添加更多参数。一旦你进入mysql,只需按ctrl + L,你就会清除屏幕。
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
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.
我遇到了同样的问题,CTRL+L 在 Windows 10 上为我工作。
I had the same issue, and CTRL+L worked for me on Windows 10.
清除 mysql 控制台
Windows 上可以使用快捷键CTRL + L
mysql console can cleared out on windows by using shortcut key
CTRL + L
对于
windows
用户只需输入system cls;
注意不要忘记在最后添加分号
;
。For
windows
user just typesystem cls;
Note don't forgot to add semicolon
;
at the last.是的,无论您使用的是
命令行客户端
还是任何Linux 终端
,您都可以清除屏幕我们在cmd中使用
cls
,在终端中使用clear
< /em> 清除屏幕。命令行客户端和终端接受相同的命令系统或\! 标志。
下面列出的两个命令都有效!
Yes, you can clear the screen no matter whether you're using
Command line Client
or anyLinux Terminal
We're using
cls
in cmd andclear
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!
只需输入
\system cls
就花了我几个小时才得到它 jejej
just type
\system cls
took me a couple hours to get it jejej
好吧,如果您安装了 MySql Server,例如版本 5.5。它的文件夹位于:
最好的方法是将其包含在您的路径中。
首先从
run
运行sysdm.cpl
小程序< /strong> 即 WinKey + R导航至高级 ->环境变量
选择PATH并单击“编辑”。
现在您可以调用:
。
要立即清除屏幕,您只需在 mysql & 中
exit
即可。调用cls
有点棘手,但确实有效。
如果您使用 WAMP 或其他工具,那就更容易了!强>
打开命令提示符并键入:
正常输入,然后每当你想清屏时,执行:
然后使用 DOS 清除:
您可以通过按两次向上键轻松重新输入以获取 mysql 调用命令
Well, if you installed MySql Server e.g. Version 5.5. which has it's folder located in:
The best way would be to include it in your paths.
First run
sysdm.cpl
applet fromrun
i.e. WinKey + RNavigate to Advanced -> Environment Variables
Select PATH and Click Edit.
Now you can just call:
via command prompt.
To clear the screen now, you can just
exit
in mysql & callcls
Kinda trickish hack but does the job.
If you're using WAMP or other tool, it's even easier!
Open command prompt and type:
Enter as normal, then whenever you want to clear screen, do:
And then clear using DOS:
You can easily re-enter by pressing up twice to get your mysql call command
您可以输入以下步骤:
mysql>出口;
C:\xampp\mysql\bin> cls
C:\xampp\mysql\bin> mysql -u root -h localhost
成功了!
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!
我的处理方式如下:
I handle it as follows:
SQL> clear scr
该命令清除 MYSQL 中的屏幕
SQL> clear scr
This command clears the screen in MYSQL
不幸的是,在 Windows 中,这是不可能的。唯一的出路是退出并输入 cls,然后再次打开 mySQL
Unfortunately in Windows, It is not possible. The only way out is to exit and type cls and then again open mySQL
它对我有用:
It worked for me using this:
对于 Windows 命令提示符
使用
For windows command prompt
Use
大多数人谈论的 Windows 上的错误可能已经修复。
Ctrl + L 适用于在 Windows 10 [Mysql 8] 上清屏
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]
单击左上方控制台窗口图标打开“属性”,转到“布局”选项卡,记下“屏幕缓冲区大小->高度”中设置的值,并将其更改为 1。单击“确定”。
您将看到一个 1 行控制台。再次打开属性并将该值更改回之前的值。缩小控制台的大小,您将拥有一个干净的控制台。
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.
已在 8.0.19 中修复。
以前,mysql命令行客户端的系统(!)命令
仅适用于 Unix 和类 Unix 系统。现在可以在 Windows 上运行
以及。例如,系统 cls 或 ! cls 可用于清除
屏幕。
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.
我使用命令行客户端提示符并清除我键入的屏幕:-
system cls
I used the command line client prompt and to clear the screen I typed:-
system cls
对于 Window 10
使用命令系统 cls,这将清除 Windows 中的 MYSQL 命令行窗口
For Window 10
Use the command system cls and this will clear the MYSQL Command Line window in Windows
截至2019年7月26日,该问题已修复。
使用它们中的任何一个都可以不带分号来清除 Windows 上的 mysql 控制台。
系统cls
\! cls
来源:
错误#58680 Windows 清屏命令
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.
system cls
\! cls
Source:
Bug #58680 Windows Clear Screen Command
添加到其他答案时,
Ctrl+L
命令在使用 PowerShell 的常规 Windows 终端中、使用mysql.exe
以及 MySQL Shell 来自 MySQL 的专用 Shell。在 Windows 11 中进行了测试,并且均有效。以下内容为 \system switch 也可以在 MySQL Shell 中使用来运行底层操作系统(在我们的例子中是 Windows 11)命令,以防
Ctrl+L
绑定到Windows 终端中的特定命令:但对于大多数用户来说
Ctrl+L
仍然应该工作。Adding to other answers the
Ctrl+L
command still works in regular Windows Terminal using PowerShell, when usingmysql.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:But for most users
Ctrl+L
should still work.对于 VSCODE 的 mysql shell,使用 CRTL + A 选择所有内容,然后按退格键删除历史记录。
For mysql shell for VSCODE use
CRTL + A
to select everything then hit backspace to delete history.单击Mysql提示符上的contextMenu按钮并选择“滚动”,因为我也没有找到任何清理方法。 =P
Click with contextMenu button on Mysql prompt and choose "Scroll", because I didn't find any way to clean too. =P