在 MySQL 中清除屏幕
本主题的主要目的是演示如何清除 MySQL 控制台的屏幕。
在 MySQL 中清除屏幕
在 MySQL 控制台上工作并管理配置和数据时,屏幕可能会因先前操作的结果而变得过于混乱。 混乱可能会导致混乱的显示,这会影响未来查询的可视化,因为混乱的显示可能会导致在通过输出进行导航时出现混乱。
考虑以下情况:
C:\Users\Admin>mysql --user=root --password=root
MySQL: [Warning] Using a password on the command line interface can be insecure.
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 10
Server version: 8.0.30 MySQL Community Server - GPL
Copyright (c) 2000, 2022, Oracle and/or its affiliates.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql> SELECT * from world.city;
+------+---------------+-------------+----------------------+------------+
| ID | Name | CountryCode | District | Population |
+------+---------------+-------------+----------------------+------------+
| 1 | Kabul | AFG | Kabol | 1780000 |
| 2 | Qandahar | AFG | Qandahar | 237500 |
| 3 | Herat | AFG | Herat | 186800 |
| 4 | Mazar-e-Sharif| AFG | Balkh | 127800 |
| 5 | Amsterdam | NLD | Noord-Holland | 731200 |
| . | . . . . . . . | . . . . . . | . . . . . . . . . . | . . . . . |
| . | . . . . . . . | . . . < OUTPUT REDACTED > . . . | . . . . . |
| . | . . . . . . . | . . . . . . | . . . . . . . . . . | . . . . . |
| 4078 | Nablus | PSE | Nablus | 100231 |
| 4079 | Rafah | PSE | Rafah | 92020 |
+------+---------------+-------------+----------------------+------------+
4079 rows in set (0.07 sec)
mysql>
执行如此大的查询后,返回检查某些内容变得很烦人,尤其是在输出中间查找特定结果时。 在所有输出中很难找到它。
为了克服这个问题,我们可以在进行过程中清除屏幕,以防止屏幕混乱。
我们可以通过多种方式清除MySQL控制台,其中一些方式如下:
使用系统清除 MySQL 控制台
根据操作系统的不同,用于清除屏幕的 cmdlet 后面的系统可用于清除 MySQL 控制台。
以下是适用于 Linux、Mac 和 Windows 的示例:
清除 Linux 中的 MySQL 控制台
您可以使用 clear 或 reset 在 Linux 上轻松清除屏幕。
# Only scrolls down
mysql> system clear
# For clearing both the history and scrollback history
mysql> system reset
使用 system clear,shell 只会向下滚动,保持旧结果不变。 如果我们需要移除卷轴,请使用系统重置。
清除 Windows 中的 MySQL 控制台
同样,对于 Windows:
mysql> system cls
我们也可以使用它的快捷方式\!
来代替书写系统。
### Linux
mysql> \! clear
mysql> \! reset
### Windows
mysql> \! cls
清除 macOS 中的 MySQL 控制台
在 macOS 上,您可以执行以下操作:
转到编辑,单击清除屏幕或使用键盘快捷键 ⌥+Cmd+L
。
清除 iTerm2 中的 MySQL 控制台
这些设置在 iTerm 中有点重命名。 使用 Clear Buffer 代替 Clear Screen。
更具体地说,转到编辑,单击清除缓冲区,或使用键盘快捷键 Cmd+K。
相关文章
如何在 MySQL 中声明和使用变量
发布时间:2024/03/26 浏览次数:115 分类:MySQL
-
当你需要在 MySQL 中的脚本中存储单个值时,最好的方法是使用变量。变量有不同的种类,有必要知道何时以及如何使用每种类型。
在 MySQL 中使用 Mysqladmin 刷新主机解除阻塞
发布时间:2024/03/26 浏览次数:82 分类:MySQL
-
你将了解阻止主机的原因。此外,通过使用 phpMyAdmin 和命令提示符刷新主机缓存来解除阻塞的不同方法和效果。