apt搜索一下

$ sudo apt search mytop
Sorting... Done
Full Text Search... Done
mytop/focal,focal,now 1.9.1-4 all
top like query monitor for MySQL

然后安装一下

sudo apt-get install mytop

直接执行 mytop 报错

$ mytop
Cannot connect to MySQL server. Please check the: * database you specified "" (default is "")
* username you specified "root" (default is "root")
* password you specified "" (default is "")
* hostname you specified "localhost" (default is "localhost")
* port you specified "3306" (default is 3306)
* socket you specified "" (default is "") The options my be specified on the command-line or in a ~/.mytop or
~/.my.cnf config file. See the manual (perldoc mytop) for details. Here's the exact error from DBI. It might help you debug: Access denied for user 'root'@'localhost' (using password: NO)

说我没有找到 .mytop 或者 my.cnf 文件,那么这个文件应该怎么配置呢?通过find寻找发现了跟mytop有关的文件夹

$ sudo find / -name "mytop"
find: ‘/proc/2308/task/2308/net’: Invalid argument
find: ‘/proc/2308/net’: Invalid argument
find: ‘/run/user/1001/doc’: Permission denied
find: ‘/run/user/1001/gvfs’: Permission denied
/usr/bin/mytop
/usr/share/doc/mytop

这个就是可执行文件,不是它

$ ll /usr/bin/mytop
-rwxr-xr-x 1 root root 60K 1月 10 2017 /usr/bin/mytop*

发现这个有配置,然后查看一下这个默认配置有个参考

$ ll /usr/share/doc/mytop
total 12K
-rw-r--r-- 1 root root 2.2K 1月 10 2017 changelog.Debian.gz
-rw-r--r-- 1 root root 1.3K 1月 10 2017 copyright
-rw-r--r-- 1 root root 871 1月 10 2017 mytop.sample.conf

发现了这个 simple conf 。好了,如此以来应该是要按这个配置,看一下它的内容

# Copy this file to ~/.mytop and customize it to your own needs

# Username to use when logging in to the MySQL server
user=root
# Password to use when logging in to the MySQL server
pass=
# Hostname of the MySQL server.
host=localhost
# Port number of the MySQL server.
port=3306
# Connect to specific database by default.
db=test
# How long between display refreshes.
delay=5
# Use direct socket instead of TCP/IP network to connect to the MySQL server.
socket=
# Run mytop only once and than exit.
batchmode=0
# Display headers or not.
header=1
# Use colors if available.
color=1
# Display idle threads.
idle=1
# Resolve IP addresses to names.
resolve=1
# Compact large numbers for better readability, e.g. 10.000 -> 10.0k.
long=0
# Reverse sort order from ascending to descending using Idle time.
sort=0
# Use vt100 escape sequences to reduce screen flicker.
vt100=0

然后配置一份文件到

touch ~/.mytop

这个文件里面配置如下内容

# Copy this file to ~/.mytop and customize it to your own needs

# Username to use when logging in to the MySQL server
user=root
# Password to use when logging in to the MySQL server
pass=密码
# Hostname of the MySQL server.
host=localhost
# Port number of the MySQL server.
port=3306
# Connect to specific database by default.
db=test
# How long between display refreshes.
delay=5
# Use direct socket instead of TCP/IP network to connect to the MySQL server.
socket=/tmp/mysql.sock
# Run mytop only once and than exit.
batchmode=0
# Display headers or not.
header=1
# Use colors if available.
color=1
# Display idle threads.
idle=1
# Resolve IP addresses to names.
resolve=1
# Compact large numbers for better readability, e.g. 10.000 -> 10.0k.
long=0
# Reverse sort order from ascending to descending using Idle time.
sort=0
# Use vt100 escape sequences to reduce screen flicker.
vt100=0

如此以来就配置好了。重新启动一下看看。

$ mytop

得到

这样以来就可以用它监控mysql 的 qps 了

ubuntu 安装使用 mytop的更多相关文章

  1. Mac OS、Ubuntu 安装及使用 Consul

    Consul 概念(摘录): Consul 是 HashiCorp 公司推出的开源工具,用于实现分布式系统的服务发现与配置.与其他分布式服务注册与发现的方案,比如 Airbnb 的 SmartStac ...

  2. ubuntu安装mysql

    好记性不如烂笔头,记录一下,ubuntu安装mysql的指令. 安装MySQL: sudo apt-get install mysql-server sudo apt-get install mysq ...

  3. ubuntu安装vim时提示 没有可用的软件包 vim,但是它被其它的软件包引用了 解决办法

    ubuntu安装vim时提示 没有可用的软件包 vim-gtk3,但是它被其它的软件包引用了 解决办法 本人在ubuntu系统安装vim  输入 sudo apt-get install vim 提示 ...

  4. docker 1.8+之后ubuntu安装指定版本docker-engine

    这边记录ubuntu安装过程,首先是官网文档 If you haven’t already done so, log into your Ubuntu instance. Open a termina ...

  5. debian/ubuntu安装桌面环境

    apt-get install xorg apt-get install gnome 然后startx ubuntu 安装Gnome桌面 1.安装全部桌面环境,其实Ubuntu系列桌面实际上有几种桌面 ...

  6. 一个ubuntu phper的自我修养(ubuntu安装)

    ubuntu安装篇 一.ubuntu下载 到ubuntu官网下载适合自己电脑配置的系统版本,此处不做展开. 二.制作USB启动盘 在windows下制作USB启动盘,工具是universal usb ...

  7. ubuntu 安装JAVA jdk的两种方法:

    ubuntu 安装jdk 的两种方式: 1:通过ppa(源) 方式安装. 2:通过官网下载安装包安装. 这里推荐第1种,因为可以通过 apt-get upgrade 方式方便获得jdk的升级 使用pp ...

  8. [其他]Ubuntu安装genymotion后unable to load VirtualBox engine

    问题: Ubuntu安装genymotion后unable to load VirtualBox engine 解决办法: 如果没有安装VirtualBox,要先安装VirtualBox. 安装Vir ...

  9. Ubuntu安装出现左上角光标一直闪解决方式

    Ubuntu安装出现左上角光标一直闪解决方式: 01下载ubunu http://cn.ubuntu.com/download/ 02.软碟通 http://pan.baidu.com/s/1qY8O ...

  10. ubuntu安装pip3

    当初入门Linux 使用的是centos,那个时候是6.0版本,当然现在主流在使用的也是6.0系列的,现在都到6.7了,那个时候centos还是独立的,现在被redhat收购,本来一个红蓝就差不多,个 ...

随机推荐

  1. mysql外键设置失败踩坑记录

    把表里面的数据清空再添加 原因 因为外键一定要对应外面那个表的数据,现在添加外键会导致这个外键的值为空,违反了键的非空约定 理解为已有的数据突然多出来个字段,但是不知道值是什么,那就为空了 主键和外键 ...

  2. 使用 SpanMetrics Connector 将 OpenTelemetry 跟踪转换为指标

    原文:https://last9.io/blog/convert-opentelemetry-traces-to-metrics-using-spanconnector/ 如果您已经实施了跟踪但缺乏强 ...

  3. C#应用 - 破解注入外挂必备神器Harmony

    目录 前言 1,快速开始 1.1 SomeGameClass类 1.2 Patch01类 1.3 MyPatcher类 1.4 跑起来 2,破解 2.1 类库项目 2.2 winform项目 3,注入 ...

  4. Linux 运行 Bitcoin 软件

    首先进入官网 bitcoin.org 下载 Bitcoin Core. 下载得到 tar.gz 文件后解压,并安装: tar xzf bitcoin-25.0-x86_64-linux-gnu.tar ...

  5. 使用 nuxi build 命令构建你的 Nuxt 应用程序

    title: 使用 nuxi build 命令构建你的 Nuxt 应用程序 date: 2024/8/30 updated: 2024/8/30 author: cmdragon excerpt: n ...

  6. docker高级篇1-dockeran安装mysql主从复制

    大家好,咱们前面通过十篇的文章介绍了docker的基础篇,从本篇开始,咱们的<docker学习系列>将要进入到高级篇阶段(基础篇大家可以查看之前发布的文章). 咱们先来介绍:docker复 ...

  7. Ollama + JuiceFS:一次拉取,到处运行

    今天这篇博客转载自我们的全栈工程师朱唯唯.在使用 Ollma 进行大模型加载时,她尝试使用了 JuiceFS 进行模型共享,JuiceFS 的数据预热和分布式缓存功能显著提升了加载效率,优化了性能瓶颈 ...

  8. nacos未授权访问漏洞,导致被网警找

    背景 公司收购了另一家公司,所以相应的后端服务和服务器都交给我管理,但是没有任何的交接文档,大概看了一下代码,依赖的东西就去忙别的了. 直到今天网警突然打电话给我说系统有漏洞(CVE-2021-294 ...

  9. CSS – Media Query

    前言 Media Query 是用来做 RWD 的, 类似 JS 的 if else. 写的多有伤管理, 所以要谨慎使用哦. 参考: Learn CSS Media Query In 7 Minute ...

  10. 对3D图像进行裁剪

    在对医学图像进行深度学习的过程中,我们会遇到图片过大,导致train的过程中网络会瘫痪,所以我们会考虑到对图像进行分割.比如一张155x240x240的图像,我们可以将他分割成一系列128x128x1 ...