首页 > 代码库 > mysql大量锁表,不重启的情况下处理办法
mysql大量锁表,不重启的情况下处理办法
mysql -u root -e "show processlist"|grep -i "Locked" >> locklist.txt; for line in awk ‘{print $1}‘ locklist.txt do echo "kill $line;">>lock_kill.sql done
查看mysql数据库表大小
#!/bin/bash database=cms user=root password=‘123456‘ mysql -u${user} -p${password} -e "use $database;show tables;" | sed ‘1d‘ | while read line; do mysql -u$user -p${password} $database -e "SELECT ‘${line}‘,ROUND(SUM(data_length/1024/1024),2) as data_length ,‘MB‘,round(SUM(index_length/1024/1024),2) as index_length,‘MB‘ FROM information_schema.TABLES WHERE information_schema.TABLES.TABLE_SCHEMA = ‘${database}‘ AND information_schema.TABLES.TABLE_NAME = ‘$line‘";done | grep -v data_length | awk ‘{print $1"\t"$2$3"\t"$4$5}‘ | sort -nrk2
本文出自 “从心开始” 博客,请务必保留此出处http://hao360.blog.51cto.com/5820068/1441324
mysql大量锁表,不重启的情况下处理办法
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。