0
点赞
收藏
分享

微信扫一扫

MariaDB 工具介绍之 mariadb-shell

MariaDB Shell是一个命令行工具,它统一了MariaDB数据库产品的故障排除和管理。 MariaDB Shell 23.03.2于2023-05-05发布。 这个版本是一个技术预览版,不应该在生产环境中使用。

安装

通过页面 https://mariadb.com/downloads/tools/ 下载安装包 将安装包上传至服务器后,直接进行 yum 安装,输出如下:

$ sudo yum install mariadb-shell-23.03-2.el7.x86_64.rpm
Loaded plugins: changelog, fastestmirror, product-id, search-disabled-repos, subscription-manager, verify

This system is not registered with an entitlement server. You can use subscription-manager to register.

Examining mariadb-shell-23.03-2.el7.x86_64.rpm: mariadb-shell-23.03-2.el7.x86_64
Marking mariadb-shell-23.03-2.el7.x86_64.rpm to be installed
Resolving Dependencies
There are unfinished transactions remaining. You might consider running yum-complete-transaction, or "yum-complete-transaction --cleanup-only" and "yum history redo last", first to finish them. If those don't work you'll have to try removing/installing packages by hand (maybe package-cleanup can help).
--> Running transaction check
---> Package mariadb-shell.x86_64 0:23.03-2.el7 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

==================================================================================================================================================================================================================================
Package                                             Arch                                         Version                                           Repository                                                               Size
==================================================================================================================================================================================================================================
Installing:
mariadb-shell                                       x86_64                                       23.03-2.el7                                       /mariadb-shell-23.03-2.el7.x86_64                                       213 M

Transaction Summary
==================================================================================================================================================================================================================================
Install  1 Package

Total size: 213 M
Installed size: 213 M
Is this ok [y/d/N]: y
Downloading packages:
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Installing : mariadb-shell-23.03-2.el7.x86_64                                                                                                                                                                               1/1
  Verifying  : mariadb-shell-23.03-2.el7.x86_64                                                                                                                                                                               1/1
Installed:
  mariadb-shell.x86_64 0:23.03-2.el7

Complete!

msh

msh 提供了若干命令,演示如下, 查看版本信息:

MariaDB (test) ? sys version
MariaDB Shell 23.03.2
Copyright (c) 2022 MariaDB plc and others.
MariaDB Server version: 10.11.3-MariaDB
Connection method:      localhost using socket
UNIX socket used:       /var/lib/mysql/mysql.sock

Uptime:                 13 days, 22:53:34
Threads Created:        10
Questions:              57423
Opened Tables:          157
Open Tables:            124
Queries per second ave: 0.047630

查看当前表:

MariaDB (test) ? ls
┌────────────────┐
│ Tables_in_test │
├────────────────┤
│ a              │
│ t1             │
│ t12            │
│ t_inet4        │
│ t_uuid         │
│ test_insert_id │
└────────────────┘
7 rows in set (0.001258).

MariaDB (test) ? dir
┌────────────────┐
│ Tables_in_test │
├────────────────┤
│ a              │
│ t1             │
│ t12            │
│ t_inet4        │
│ t_uuid         │
│ test_insert_id │
└────────────────┘
7 rows in set (0.000777).

可以将输出格式转为 sqlplus :

MariaDB (test) ? output sqlplus
Output format changed to sqlplus

MariaDB (test) ? ls
Tables_in_test
--------------------
a
t1
t12
t_inet4
t_uuid
test_insert_id
6 rows in set (0.000960).

MariaDB Shell的第一个版本有一些很棒的新特性,比如能够在内存存储引擎缓存中预热,比如InnoDB缓冲池。

MariaDB (test) ? warm t1
Warning: Large tables will take a significant amount of time to warm.
test.t1 has been read into memory.
MariaDB (test) ? warm
Warning: Large tables will take a significant amount of time to warm.
test.t_inet4 has been read into memory.
test.t_uuid has been read into memory.
test.t12 has been read into memory.
test.t1 has been read into memory.
test.a has been read into memory.
test.test_insert_id has been read into memory.

当然,msh 还提供了若干系统命令,命令列表如下:

MariaDB (test) ? sys

ADMIN, SYS or SYSTEM commands are the gateway to all things administration-management for MariaDB products.

Currently available commands for this tool are:

create, drop, shutdown, reload, refresh, version, processlist, status, kill, debug, variables, flush-logs, flush-hosts, flush-tables, password, ping, extended-status, replication-status, replica-status, all-replication-status, all-replica-status, flush-status, flush-privileges, start-slave, stop-slave, start-all-slaves, stop-all-slaves, start-replica, stop-replica, start-all-replicas, stop-all-replicas, flush-threads, old-password, flush-binary-log, flush-engine-log, flush-error-log, flush-general-log, flush-relay-log, flush-slow-log, flush-table-statistics, flush-index-statistics, flush-user-statistics, flush-client-statistics, flush-user-resources, flush-all-status, flush-all-statistics, flush-ssl, load-buffer-pool, dump-buffer-pool, memory-config, pre-slice

举报

相关推荐

0 条评论