apt搜索一下

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

然后安装一下

sudo apt-get install mytop

直接执行 mytop 报错

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

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

  1. $ sudo find / -name "mytop"
  2. find: ‘/proc/2308/task/2308/net’: Invalid argument
  3. find: ‘/proc/2308/net’: Invalid argument
  4. find: ‘/run/user/1001/doc’: Permission denied
  5. find: ‘/run/user/1001/gvfs’: Permission denied
  6. /usr/bin/mytop
  7. /usr/share/doc/mytop

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

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

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

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

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

  1. # Copy this file to ~/.mytop and customize it to your own needs
  2.  
  3. # Username to use when logging in to the MySQL server
  4. user=root
  5. # Password to use when logging in to the MySQL server
  6. pass=
  7. # Hostname of the MySQL server.
  8. host=localhost
  9. # Port number of the MySQL server.
  10. port=3306
  11. # Connect to specific database by default.
  12. db=test
  13. # How long between display refreshes.
  14. delay=5
  15. # Use direct socket instead of TCP/IP network to connect to the MySQL server.
  16. socket=
  17. # Run mytop only once and than exit.
  18. batchmode=0
  19. # Display headers or not.
  20. header=1
  21. # Use colors if available.
  22. color=1
  23. # Display idle threads.
  24. idle=1
  25. # Resolve IP addresses to names.
  26. resolve=1
  27. # Compact large numbers for better readability, e.g. 10.000 -> 10.0k.
  28. long=0
  29. # Reverse sort order from ascending to descending using Idle time.
  30. sort=0
  31. # Use vt100 escape sequences to reduce screen flicker.
  32. vt100=0

然后配置一份文件到

  1. touch ~/.mytop

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

  1. # Copy this file to ~/.mytop and customize it to your own needs
  2.  
  3. # Username to use when logging in to the MySQL server
  4. user=root
  5. # Password to use when logging in to the MySQL server
  6. pass=密码
  7. # Hostname of the MySQL server.
  8. host=localhost
  9. # Port number of the MySQL server.
  10. port=3306
  11. # Connect to specific database by default.
  12. db=test
  13. # How long between display refreshes.
  14. delay=5
  15. # Use direct socket instead of TCP/IP network to connect to the MySQL server.
  16. socket=/tmp/mysql.sock
  17. # Run mytop only once and than exit.
  18. batchmode=0
  19. # Display headers or not.
  20. header=1
  21. # Use colors if available.
  22. color=1
  23. # Display idle threads.
  24. idle=1
  25. # Resolve IP addresses to names.
  26. resolve=1
  27. # Compact large numbers for better readability, e.g. 10.000 -> 10.0k.
  28. long=0
  29. # Reverse sort order from ascending to descending using Idle time.
  30. sort=0
  31. # Use vt100 escape sequences to reduce screen flicker.
  32. vt100=0

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

  1. $ 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. love music

    https://music.163.com/outchain/player?type=2&id=215239

  2. 使用Vue3.5的onWatcherCleanup封装自动cancel的fetch函数

    前言 在欧阳的上一篇 这应该是全网最详细的Vue3.5版本解读文章中有不少同学对Vue3.5新增的onWatcherCleanup有点疑惑,这个新增的API好像和watch API回调的第三个参数on ...

  3. dotnet 学习 CPF 框架笔记 了解 X11 里如何获取触摸信息

    本文记录我学习 CPF 框架的笔记,本文记录我阅读 CPF 框架,学习到了如何在 dotnet C# 里面获取到 X11 的触摸信息,获取到多指触摸以及触摸点的面积和触摸点压感等信息的方法 开始之前, ...

  4. DVI与VGA有什么区别?

    DVI接口:DVI(Digital Visual Interface),即数字视频接口.DVI接口速度快.画面清晰.支持HDCP协议. VGA接口:VGA(Video Graphics Array)即 ...

  5. 为什么我觉得需要熟悉vim使用,难道仅仅是为了耍酷?

    实例说话: 使用vscode保存,有报提示信息,可以以超级用户身份重试,于是我授权root给vscode软件,却还提示失败! 而实际上,我使用cat命令发现已经写入成功了 终端内使用cat这条shel ...

  6. 第41天:WEB攻防-ASP应用&HTTP.SYS&短文件&文件解析&Access注入&数据库泄漏

    #ASP-中间件-CVE&短文件&解析&写权限 -HTTP.SYS(CVE-2015-1635) 1.漏洞描述 远程执行代码漏洞存在于 HTTP 协议堆栈 (HTTP.sys) ...

  7. 第16天:信息打点-CDN绕过&业务部署&漏洞回链&接口探针&全网扫描&反向邮件

    #CDN配置: 配置1:加速域名-需要启用加速的域名 配置2:加速区域-需要启用加速的地区 配置3:加速类型-需要启用加速的资源 #参考知识: 超级Ping:http://www.17ce.com/ ...

  8. ARM SMMU的原理与IOMMU

    首先放一个社区iommupatch的网址:https://lore.kernel.org/linux-iommu/ 1: arm smmu的原理 1.1: smmu 基本知识 如上图所示,smmu 的 ...

  9. C# 的显示转换 *.Parse(string) Convert.ToInt32(double value)

    // 显式转换 (类型) /// (int)表示使用强制的显示转换,是一种类型转换,C#默认的整形是 int32 , /// 因此使用此方法转成int32 不遵循四舍五入,直截取整数部分 /// (i ...

  10. C#的引用类型

    引用类型的基类为 Object 引用类型:类Class.接口Interface.委Delegrate.数组Array