mysql -uroot -poRcl_123 -Dsnsdb_test -e "select host from user;"

mysql -uroot -poRcl_123 -Dmysql -e "show variables like '%Thread%';"

mysql -uroot -poRcl_123 -Dmysql -e "show status like '%Threads_connected%';"

mysql -uroot -poRcl_123 -Dmysql -e "show status;"

mysql -uroot -poRcl_123 -Dmysql -e "show variables like 'max_connections';"

mysql -uroot -poRcl_123 -Dmysql -e "show full processlist \G;"

mysql -uroot -poRcl_123 -Dmysql -e "show processlist\G;"| egrep "Host\:" | awk -F: '{ print $2 }'| sort | uniq -c

使用grep过滤

mysql -uroot -poRcl_123 -Dmysql -e "show processlist\G;"| egrep "Host\:" | awk -F: '{ print $2 }'| sort | uniq -c | grep 192.168.10.45

//查看占用的总的数据库连接数

mysql -uroot -poRcl_123 -Dmysql -e "select count(*) from information_schema.PROCESSLIST;"

select count(*) from information_schema.PROCESSLIST

mysql -uroot -poRcl_123 -Dmysql -e "show global status like 'Max_used_connections';"

//循环输出

while true;do mysql -uroot -poRcl_123 -Dmysql -e "show processlist\G;"| egrep "Host\:" | awk -F: '{ print $2 }'| sort | uniq -c;echo "******************************************";sleep 1;done

mysql -uroot -poRcl_123 -Dmysql -e "show variables"  | grep max_connections

mysql -uroot -poRcl_123 -Dmysql -e "show status;"

netstat -anp | grep 3306 | grep 192.168.10.99 | wc -l

mysql -uroot -poRcl_123 -Dmysql -e "show variables like 'max_connections';"

mysql -uroot -poRcl_123 -Dmysql -e "show variables like 'max_connections';"

mysql -uroot -poRcl_123 -Dmysql -e "select SUBSTRING_INDEX(host,':',1) as ip , count(*) from information_schema.processlist group by ip;"

mysql -uroot -poRcl_123 -Dmysql --skip-column-names -e"show processlist;"|awk '{print $3}'|awk -F":" '{print $1}'|sort|uniq -c

mysql -uroot -poRcl_123 -Dmysql -e "show processlist\G;"| egrep "Host\:" | awk -F: '{ print $2 }'| sort | uniq -c

shell界面执行mysql命令的更多相关文章

  1. 转 【MySQL】常用拼接语句 shell 下执行mysql 命令

    [MySQL]常用拼接语句 前言:在MySQL中 CONCAT ()函数用于将多个字符串连接成一个字符串,利用此函数我们可以将原来一步无法得到的sql拼接出来,在工作中也许会方便很多,下面主要介绍下几 ...

  2. shell 下执行mysql 命令

    From: http://blog.csdn.net/beginning1126/article/details/8590014 方案1 mysql -uuser -ppasswd -e 优点:语句简 ...

  3. 总结不进入Mysql,执行Mysql命令的5种方法

    不进入mysql,执行mysql命令 直接使用-e 命令 mysql -u root -p xxxxxx -e "show databases;" 使用eof写入命令 mysql ...

  4. hbase shell中执行list命令报错:ERROR: org.apache.hadoop.hbase.PleaseHoldException: Master is initializing

    问题描述: 今天在测试环境中,搭建hbase环境,执行list命令之后,报错: hbase(main):001:0> list TABLE ERROR: org.apache.hadoop.hb ...

  5. shell执行mysql命令

    难点主要在参数的传递方式吧,不过查资料后发现很简单. 1.使用-e参数传递命令,适用于简单语句      mysql -uuser -ppasswd -e "create database ...

  6. shell脚本中执行mysql命令

    1.mysql -hhostname -uuser -ppsword -e "mysql_cmd" 2. mysql -hhostname -uuser -ppsword < ...

  7. 通过ant调用shell脚本执行adb命令

    在Hudson或者Jenkins中利用ant的exec 来调用shell命令,通过shell脚本来执行adb shell命令,可以正常执行,不会出现在ant中直接调用adb shell出现的假死情况. ...

  8. shell中执行hive命令错误:delimited by end-of-file (wanted `EOF')

    错误信息: warning: here-document at line 58 delimited by end-of-file (wanted `EOF') 业务场景,使用hive对数据进行批量清洗 ...

  9. shell脚本执行sql命令

    参考:https://www.cnblogs.com/xingchong/p/11698237.html

随机推荐

  1. 通过URL传递中文参数的乱码处理

    环境:web.xml中配置了 <filter> <filter-name>encodingFilter</filter-name> <filter-class ...

  2. xl2tpd[26104]: Maximum retries exceeded for tunnel 33925. Closing

    Sep  5 14:31:50 root charon: 13[ENC] generating QUICK_MODE request 3930082374 [ HASH ]Sep  5 14:31:5 ...

  3. nginx多虚拟主机优先级location匹配规则及tryfiles的使用

    nginx多虚拟主机优先级location匹配规则及tryfiles的使用 .相同server_name多个虚拟主机优先级访问 .location匹配优先级 .try_files使用 .nginx的a ...

  4. php password_hash

    2018-1-6 17:22:13 星期六 php 自带的密码生成方法, 如果生成密码最好使用这个, 这个是"单程"的, 没有解密函数 $a = '123456'; $b = pa ...

  5. Centos 6.5 freeswitch 编译mod_shout

    1. yum install -y patch 2. yum install -y libshout-devel lame-devel libmpg123-devel 3. make install ...

  6. unit test

    1) State vs Behaviour Verificationhttps://manas.tech/blog/2009/04/30/state-vs-behaviour-verification ...

  7. vue.js插槽

    具体讲解的url https://github.com/cunzaizhuyi/vue-slot-demo //例子 用jsfiddle.net去运行就好 <!DOCTYPE html> ...

  8. java按照关键字指定的key删除redis(支持模糊删除)

    pom依赖: <dependency> <groupId>redis.clients</groupId> <artifactId>jedis</a ...

  9. 远程连接阿里云的mysql数据库

    第一步 由于mysql版本问题 先尝试打开 sudo vim /etc/mysql/my.cnf 如空,再尝试打开 sudo vim /etc/mysql/mysql.conf.d/mysqld.cn ...

  10. Django 笔记(二) 新建 ~ 渲染

    新建APP python manange.py startapp app_name 然后右键 pycharm 的项目目录,将新建的目录从服务器上下载进来 URL(Uniform Resoure Loc ...