# 删除数据库内容 #数据库删除语句 del_co_block="DELETE FROM co_block WHERE time<='${timestamp}'" del_co_container="DELETE FROM co_container WHERE time<='${timestamp}'" del_co_entity="DELETE FROM co_entity WHERE time<='${timestamp}'" del_co_item="DELETE FROM co_item WHERE time<='${timestamp}'" del_co_session="DELETE FROM co_session WHERE time<='${timestamp}'" optimize_co_block="optimize table co_block" optimize_co_container="optimize table co_container" optimize_co_entity="optimize table co_entity" optimize_co_item="optimize table co_item" optimize_co_session="optimize table co_session"
echo "=========【错误】===========" echo "输入有误" echo "已停止执行" echo "============================" exit fi
使用
彩蛋
查看数据库占用空间 “coreprotect”为数据库名
1
mysql> 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 where table_schema='coreprotect';