mysql常用监控脚本命令整理_MySQL
程序员文章站
2024-01-12 17:24:16
...
bitsCN.com
#/bin/sh
#检测mysql server是否正常提供服务
mysqladmin -u sky -ppwd -h localhost ping
#获取mysql当前的几个状态值
mysqladmin -u sky -ppwd -h localhost status
#获取数据库当前的连接信息
mysqladmin -u sky -ppwd -h localhost processlist
#获取当前数据库的连接数
mysql -u root -p123456 -BNe "select host,count(host) from processlist group by host;" information_schema
#显示mysql的uptime
mysql -e"SHOW STATUS LIKE '%uptime%'"|awk '/ptime/{ calc = $NF / 3600;print $(NF-1), calc"Hour" }'
#查看数据库的大小
mysql -u root -p123456-e 'select table_schema,round(sum(data_length+index_length)/1024/1024,4) from information_schema.tables group by table_schema;'
#查看某个表的列信息
mysql -u --password= -e "SHOW COLUMNS FROM "
#/bin/sh
#检测mysql server是否正常提供服务
mysqladmin -u sky -ppwd -h localhost ping
#获取mysql当前的几个状态值
mysqladmin -u sky -ppwd -h localhost status
#获取数据库当前的连接信息
mysqladmin -u sky -ppwd -h localhost processlist
#获取当前数据库的连接数
mysql -u root -p123456 -BNe "select host,count(host) from processlist group by host;" information_schema
#显示mysql的uptime
mysql -e"SHOW STATUS LIKE '%uptime%'"|awk '/ptime/{ calc = $NF / 3600;print $(NF-1), calc"Hour" }'
#查看数据库的大小
mysql -u root -p123456-e 'select table_schema,round(sum(data_length+index_length)/1024/1024,4) from information_schema.tables group by table_schema;'
#查看某个表的列信息
mysql -u
上一篇: 求教几句JS代码_html/css_WEB-ITnose
下一篇: C#性能优化
网友评论
文明上网理性发言,请遵守 新闻评论服务协议
我要评论