如何在 Windows 中清除 MySQL 屏幕控制台?

发布于 2024-12-26 03:54:22 字数 213 浏览 2 评论 0 原文

标题就是我的问题。我用谷歌搜索并尝试了类似的方法

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

blah blah ...

,但没有一个有效。

有人告诉我如何清除屏幕,就像 Windows 中的 cls 命令一样吗?

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?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(29

雨轻弹 2025-01-02 03:54:22

您输入的命令错误。它是 \! 之前而不是之后。

命令 Ctrl+L 不适用于 Windows。要清除 MySQL 控制台屏幕,请键入以下命令:

mysql> \! cls

说明:

  • \! 用于执行系统 shell 命令
  • cls 是清除 MySQL 控制台屏幕的命令。 Windows 命令提示符屏幕

这将完成 Windows 的工作。


同样,如果您使用的是 Linux,您将输入 Ctrl+L 或以下内容:

mysql> \! clear

来源: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:

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

木落 2025-01-02 03:54:22

我认为任何命令都不起作用。

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

冷月断魂刀 2025-01-02 03:54:22

这在 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

强者自强 2025-01-02 03:54:22
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
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
极度宠爱 2025-01-02 03:54:22

只需用鼠标向下滚动

在 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

荒岛晴空 2025-01-02 03:54:22

在 Linux 上:您可以使用 ctrl + L 或键入命令 systemclear

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

愁以何悠 2025-01-02 03:54:22

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

Smile简单爱 2025-01-02 03:54:22

这就是我为解决这个错误所做的事情。除了一些简单的命令之外,Windows 控制台 (cmd) 不值得使用。所以以下就是我所做的。

已安装 Cygwin(前往此处)安装非常简单。您可以观看此视频。它非常简单地解释了如何安装 cygwin。确保当您选择要安装的软件包时包括 Mintt(它基本上是一个更好的 shell 或 cmd)和 mysql 客户端软件包。

安装完成后,您应该将 cygwin 中的 bin 文件夹添加到 PATH 环境变量中(上面的视频也解释了这一点)

现在您将在桌面上看到 cygwin 的图标。打开它并使用普通命令登录 mysql。您需要将 mysql 服务器的 IP 放入命令中才能使其工作。我在通过 wamp 安装的 MySQL 中使用以下日志记录,

mysql -u root -p -h 127.0.0.1 

如果需要,您可以在其中添加更多参数。一旦你进入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

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.

累赘 2025-01-02 03:54:22

我遇到了同样的问题,CTRL+L 在 Windows 10 上为我工作。

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

救星 2025-01-02 03:54:22

清除 mysql 控制台

Windows 上可以使用快捷键CTRL + L

mysql console can cleared out on windows by using shortcut key

CTRL + L

凡尘雨 2025-01-02 03:54:22

对于windows用户只需输入system cls;

注意不要忘记在最后添加分号;

输入图片此处描述

For windows user just type system cls;

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

enter image description here

花开柳相依 2025-01-02 03:54:22

是的,无论您使用的是命令行客户端还是任何Linux 终端,您都可以清除屏幕

我们在cmd中使用cls,在终端中使用clear< /em> 清除屏幕。
命令行客户端终端接受相同的命令系统\! 标志。
下面列出的两个命令都有效!

命令行客户端:

系统cls

<前><代码>\! CLS

对于终端:

系统清除;

<前><代码>\!清除;

其他命令可以在此处找到MySql 命令行客户端
从网站右上角更改版本号。

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.

笑叹一世浮沉 2025-01-02 03:54:22

只需输入 \system cls

就花了我几个小时才得到它 jejej

just type \system cls

took me a couple hours to get it jejej

痴意少年 2025-01-02 03:54:22

好吧,如果您安装了 MySql Server,例如版本 5.5。它的文件夹位于:

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

最好的方法是将其包含在您的路径中。

  • 首先从run运行sysdm.cpl小程序< /strong> 即 WinKey + R

  • 导航至高级 ->环境变量

  • 选择PATH并单击“编辑”。

  • 滚动到文本末尾,然后添加 ";C:\Program Files\MySQL\MySQL Server 5.5\bin"(不带引号)(请注意以分号开头的文本,仅当它尚不存在时才应添加),

现在您可以调用:

启动 /b /等待 mysql -u root -p

要立即清除屏幕,您只需在 mysql & 中 exit 即可。调用cls

有点棘手,但确实有效。

如果您使用 WAMP 或其他工具,那就更容易了!强>

打开命令提示符并键入:

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

正常输入,然后每当你想清屏时,执行:

退出退出

然后使用 DOS 清除:

cls

您可以通过按两次向上键轻松重新输入以获取 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 2025-01-02 03:54:22

您可以输入以下步骤:

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!

笑,眼淚并存 2025-01-02 03:54:22

我的处理方式如下:

  1. 右键单击cmd打开属性的goto布局
  2. 将屏幕缓冲区高度设置为9999然后确定
  3. 现在每当你想输入新的查询时,只需滚动鼠标,你就会得到一个空白屏幕

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
简单气质女生网名 2025-01-02 03:54:22

SQL> clear scr

该命令清除 MYSQL 中的屏幕

SQL> clear scr

This command clears the screen in MYSQL

柠檬心 2025-01-02 03:54:22

不幸的是,在 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

ぽ尐不点ル 2025-01-02 03:54:22

它对我有用:

clear screen

It worked for me using this:

clear screen
撩起发的微风 2025-01-02 03:54:22

对于 Windows 命令提示符

使用

system cls

For windows command prompt

Use

system cls
柳絮泡泡 2025-01-02 03:54:22

大多数人谈论的 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]

别理我 2025-01-02 03:54:22

单击左上方控制台窗口图标打开“属性”,转到“布局”选项卡,记下“屏幕缓冲区大小->高度”中设置的值,并将其更改为 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.

enter image description here

时间你老了 2025-01-02 03:54:22

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

眼眸里的那抹悲凉 2025-01-02 03:54:22

我使用命令行客户端提示符并清除我键入的屏幕:-

system cls

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

system cls

半仙 2025-01-02 03:54:22

对于 Window 10

使用命令系统 cls,这将清除 Windows 中的 MYSQL 命令行窗口

For Window 10

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

那一片橙海, 2025-01-02 03:54:22

截至2019年7月26日,该问题已修复。

使用它们中的任何一个都可以不带分号来清除 Windows 上的 mysql 控制台。

  1. 系统cls

  2. \! 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.

  1. system cls

  2. \! cls

Source:
Bug #58680 Windows Clear Screen Command

日暮斜阳 2025-01-02 03:54:22

添加到其他答案时,Ctrl+L 命令在使用 PowerShell 的常规 Windows 终端中、使用 mysql.exe 以及 MySQL Shell 来自 MySQL 的专用 Shell。在 Windows 11 中进行了测试,并且均有效。
以下内容为 \system switch 也可以在 MySQL Shell 中使用来运行底层操作系统(在我们的例子中是 Windows 11)命令,以防 Ctrl+L 绑定到Windows 终端中的特定命令:

\system cls

Windows 11 内 Windows 终端中的 SQL Shell

但对于大多数用户来说 Ctrl+L 仍然应该工作。

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.

安人多梦 2025-01-02 03:54:22

对于 VSCODE 的 mysql shell,使用 CRTL + A 选择所有内容,然后按退格键删除历史记录。

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

染墨丶若流云 2025-01-02 03:54:22

单击Mysql提示符上的contextMenu按钮并选择“滚动”,因为我也没有找到任何清理方法。 =P

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

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文