ubuntu 安装使用 mytop
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的更多相关文章
- Mac OS、Ubuntu 安装及使用 Consul
Consul 概念(摘录): Consul 是 HashiCorp 公司推出的开源工具,用于实现分布式系统的服务发现与配置.与其他分布式服务注册与发现的方案,比如 Airbnb 的 SmartStac ...
- ubuntu安装mysql
好记性不如烂笔头,记录一下,ubuntu安装mysql的指令. 安装MySQL: sudo apt-get install mysql-server sudo apt-get install mysq ...
- ubuntu安装vim时提示 没有可用的软件包 vim,但是它被其它的软件包引用了 解决办法
ubuntu安装vim时提示 没有可用的软件包 vim-gtk3,但是它被其它的软件包引用了 解决办法 本人在ubuntu系统安装vim 输入 sudo apt-get install vim 提示 ...
- docker 1.8+之后ubuntu安装指定版本docker-engine
这边记录ubuntu安装过程,首先是官网文档 If you haven’t already done so, log into your Ubuntu instance. Open a termina ...
- debian/ubuntu安装桌面环境
apt-get install xorg apt-get install gnome 然后startx ubuntu 安装Gnome桌面 1.安装全部桌面环境,其实Ubuntu系列桌面实际上有几种桌面 ...
- 一个ubuntu phper的自我修养(ubuntu安装)
ubuntu安装篇 一.ubuntu下载 到ubuntu官网下载适合自己电脑配置的系统版本,此处不做展开. 二.制作USB启动盘 在windows下制作USB启动盘,工具是universal usb ...
- ubuntu 安装JAVA jdk的两种方法:
ubuntu 安装jdk 的两种方式: 1:通过ppa(源) 方式安装. 2:通过官网下载安装包安装. 这里推荐第1种,因为可以通过 apt-get upgrade 方式方便获得jdk的升级 使用pp ...
- [其他]Ubuntu安装genymotion后unable to load VirtualBox engine
问题: Ubuntu安装genymotion后unable to load VirtualBox engine 解决办法: 如果没有安装VirtualBox,要先安装VirtualBox. 安装Vir ...
- Ubuntu安装出现左上角光标一直闪解决方式
Ubuntu安装出现左上角光标一直闪解决方式: 01下载ubunu http://cn.ubuntu.com/download/ 02.软碟通 http://pan.baidu.com/s/1qY8O ...
- ubuntu安装pip3
当初入门Linux 使用的是centos,那个时候是6.0版本,当然现在主流在使用的也是6.0系列的,现在都到6.7了,那个时候centos还是独立的,现在被redhat收购,本来一个红蓝就差不多,个 ...
随机推荐
- how to create rpm
RPM Spec 中各个字段的 pre, post, preun, postun 的用法 https://www.golinuxhub.com/2018/05/how-to-execute-scrip ...
- Excel中制作目录的3种方法,你了解几种?
点赞再看,养成习惯:言之无文,行而不远. 微信搜索[亦心Excel]关注这个不一样的自媒体人. 本文 GitHub https://github.com/hugogoos/Excel 已收录,包含Ex ...
- CSS单位em、rem、vh和vw等及CSS3的calc()以及line-height百分比
css单位我们常用的是px,也即是像素.随着网页开发自适应的要求,css3新增了许多单位,rem.vw和vh.vmin和vmax.ch和ex等. em 做前端的应该对em不陌生,不是什么罕见的单位,是 ...
- Angular Material 18+ 高级教程 – CDK Portal
前言 CDK Portal 是 Angular Material 对 Angular Dynamic Component (ViewContainerRef,TemplateRef,createCom ...
- SpringBoot——项目快速启动
SpringBoot项目快速启动 对SpringBoot项目打包(执行Maven构建指令package) 执行后会生成对应的项目 jar包,在文件夹找到该文件 在对应文件夹下即可执行 j ...
- SpringMVC——SSM整合-异常处理器
异常处理器 出现异常的常见位置与常见诱因: 框架内部抛出的异常:因使用不合规导致 数据层抛出异常:因外部服务器故障导致(例如:服务器访问超时) 业务层抛出的异常:因业务逻辑书写错误导致(例如:遍历业务 ...
- DQL—查询操作
一.查询语法 select 字段列表 from 表名列表 where 条件列表 group by 分组列表 having 分组后条件 order by 排序字段 limit 分页限定 (提供一个表来操 ...
- 一,初始 MyBatis-Plus
一,初始 MyBatis-Plus @ 目录 一,初始 MyBatis-Plus 1. MyBatis-Plus 的概述 2. 入门配置第一个 MyBatis-Plus 案例 3. 补充说明: 3.1 ...
- 暑假集训CSP提高模拟18
\[暑假集训CSP提高模拟 \ 1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1 \] Very good problem, this make my news rotate. ...
- .Net Web项目中,实现轻量级本地事件总线 框架
一.事件总线设计方案 1.1.事件总线的概念 事件总线是一个事件管理器,负责统一处理系统中所有事件的发布和订阅. 事件总线模式通过提供一种松耦合的方式来促进系统内部的业务模块之间的通信,从而增强系统的 ...