java多线程    Java入门    vsftp    ftp    linux配置    centos    FRP教程    HBase    Html5缓存    webp    zabbix    分布式    neo4j图数据库    

自动删除mysql表,备份,切割

运营的路上,乐趣无群 诊断到了那些数据库在占空间,就想到了备份,压缩,删除的策略。 #!/bin/sh BIN_DIR="/Applications/XAMPP/bin" MYUSER="urldb" MYPASS="123456" DB_NAME="crm" TABLE="fis_cash" BCK_DIR="/Users/ge" MAX_ID=`$BIN_DIR/mysql -u$MYUSER -p$MYPASS -Bse "select max(id) from $DB_NAME.$TABLE"` $BIN_DIR/mysqldump -h lo More


MySQL查看数据库表容量大小

发现数据库占了很多空间,于是收集到了这个脚本 1.查看所有数据库容量大小 select table_schema as '数据库', sum(table_rows) as '记录数', sum(truncate(data_length/1024/1024, 2)) as '数据容量(MB)', sum(truncate(index_length/1024/1024, 2)) as '索引容量(MB)' from information_schema.tables group by table_schema order by sum(data_leng More


一次性备份mysql全部的数据库

遍历mysql 数据库 有多少表 #!/bin/sh BIN_DIR="/usr/local/mysql/bin" DATE=`date +%F` BCK_DIR="/backup/backupwebsite/mysql/all/$DATE" mkdir -p $BCK_DIR DBS=`mysql -Bse "show databases"|grep -v "information_schema" |grep -v "test"` for DB_NAME in $DBS do echo $DB_NAME done 一次性备份mysql数据库所有表 #!/bin/sh BIN_D More