作者:马楚成 (Ivan Ma)
编译:徐轶韬
MySQL Shell is a powerful tool. It allows Javascript, Python and SQL access to MySQL.MySQL Shell是一个功能强大的工具。它允许Javascript,Python和SQL访问MySQL。
Usage of MySQL Shell can be
1. As admin tool to MySQL Server
2. As Scripting Engine to run Javascript or Python or SQL to access MySQL Server
3. As a tools to allow Document Store access (like collection API) with MySQL Server
4. As MySQL InnoDB Cluster admin Tooling
可以使用MySQL Shell。
1.作为MySQL Server的管理工具。
2.作为运行Javascript或Python或SQL的脚本引擎,以访问MySQL Server。
3.作为允许通过MySQL Server访问文档存储(如集合API)的工具。
4.作为MySQL InnoDB Cluster管理工具。
Customization and extensible framework is essential to a tool as such DB administrators can create customized report and extension to do the daily job.
自定义和可扩展框架对于工具至关重要,数据库管理员可以创建自定义的报告和扩展来执行日常工作。
This tutorial is written to provide a short summary how we can create a MySQL Shell Report in Python.编写本教程的目的是提供一个简短摘要,介绍如何使用Python创建MySQL Shell报告。
What is MySQL Shell Report
MySQL Shell report can be executed thru "\show"
什么是MySQL Shell报表MySQL Shell报表可以通过“ \ show”执行
There are 3 'report's coming with MySQL Shell - namely 'query', 'thread', 'threads'.MySQL Shell附带3个“报告”,即'query', 'thread', 'threads'。
Query Report :
Getting the "help" with a report can simply to run "\show query --help"
查询报告:获取报告“帮助”可以简单地运行“ \ show query --help”
Running a Report with a connected session as such the query is executed and printed on the screen (e.g. Running "SELECT 1" query)
通过连接的会话运行报告,这样查询将被执行并打印在屏幕上(例如,运行“ SELECT 1”查询)
Creating a New Report in Python - DB Size使用Python创建新报告-数据库大小
MySQL Shell allows customization based on the $HOME/.mysqlsh/plugins/ folderMySQL Shell允许基于$ HOME / .mysqlsh / plugins /folder进行自定义
When MySQL Shell is launched, it looks for all initialization script (init.py / init.js) within the "plugins" folder.启动MySQL Shell时,它将在“ plugins”中查找所有初始化脚本(init.py / init.js)。”文件夹。
File : $HOME/.mysqlsh/plugins/ext/dbutil/init.py
Once the file is created under the $HOME/.mysqlsh/plugins/ext/dbutil/init.py, MySQL Shell looks up NEW report and the "\show" shows the added "dbsize" report.
在$ HOME / .mysqlsh / plugins / ext / dbutil / init.py下创建文件后,MySQL Shell将查找新报告,而“ \ show”将显示添加的“ dbsize”报告。
With a CONNECTED session, and Running the report can be simply to execute "\show dbsize"
使用CONNECTED会话,然后运行报告,可以简单地执行“ \ show dbsize”。
There is OPTION "limit" which we put into the Python init.py. To show only 3 lines, we can add option (-l 3) as shown as follows.
我们在Python init.py中放入了OPTION“ limit”。仅显示3行,可以如下所示添加选项(-l 3)。
转文至此。
![b0fb8a418190b0580e532fbe38e5618d.png](https://i-blog.csdnimg.cn/blog_migrate/51a0b4946285034d4ed695ae9c32c762.jpeg)
近期热文 你可能也会对以下话题感兴趣。点击链接便可查看。
- MySQL:主从同步延迟Seconds_Behind_Master越来越大,什么鬼?
- WIN10 install MySQL8.0.21
- MySQL8.0.19的InnoDB ReplicaSet
- MySQL 8.0 常见问题——群组复制篇
- 生产环境_MySQL企业版5.7.30单实例快速部署
- MySQL是时候该升级8.0了!
- 如果要升级到MySQL 8.0,可以分几个阶段走
- MySQL安全性解决方案
- 编写MySQL Shell插件(REPORT)
- MySQL官方监管好帮手__MEM(MySQL Enterprise Monitor)
- 通过Maxwell解析MySQL Binlog,打好业务多活的基础
- MySQL安全性解决方案,是个啥?
- 如果要升级到MySQL 8.0,可以分几个阶段走
- Oracle和MySQA
- MySQL中left join的几个SQL对比X
- MySQL静态数据加密和企业版TDE
- MySQL8功能详解——数据字典
- MySQL中如何查看正在执行的SQL语句?
- MySQL的主键命名挺任性,就这么定了
- 浅谈MySQL三种锁:全局锁、表锁和行锁
- LINUX环境:MySQL和Oracle开机自启动,咋搞?
- 生产环境:mysqlbackup逻辑备份的一种shell脚本实现
- 生产环境:mysqlbackup物理备份的一种shell脚本实现
- MySql 8.0.16 客户端连接失败
- Oracle如何访问MySql:透明网关
- 一款好的数据库监控工具:天兔数据库监控系统V3.8搭建
- MySQL主从架构搭建+GTID同步方式部署
- 用户:单台服务器部署多MySQL实例,咋弄?
- MySQL服务器一次异常掉电的恢复
- MySQL8.0.18新特性之bash join探究