To count the number of connections to a database, we typically count the totals without subdividing each IP. Now to monitor the number of connections per IP, the implementation is as follows:
Method One:
Select Substring_index (Host, ': ', 1) as IP, COUNT (*) from the information_schema.processlist group by IP;
Method Two:
Mysql-u root-h127.0.0.1-e "show processlist\g;" | Egrep "Host\:" | Awk-f: ' {print $} ' | Sort | Uniq-c
Method Three:
Mysql-u root-h127.0.0.1--skip-column-names-e "show processlist;" | awk ' {print $} ' |awk-f ': ' ' {print '} ' |sort|uniq–c
Reference blog:
Http://www.toxingwang.com/database/mysql/2715.html
Chechebeaux the Lord's share. Thank you
This article from "for the Dream and strive!" "Blog, be sure to keep this provenance http://815632410.blog.51cto.com/1544685/1677728
View IP information connected to MySQL database