script
# 创建数据库
指定字符集和排序规则
CREATE DATABASE `pilot` DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
1
# 统计数据库占用空间
select table_schema as '数据库',
table_name as '表名',
table_rows as '记录数',
truncate(data_length / 1024 / 1024, 2) as '数据容量(MB)',
truncate(index_length / 1024 / 1024, 2) as '索引容量(MB)'
from information_schema.TABLES
order by data_length desc, index_length desc;
1
2
3
4
5
6
7
2
3
4
5
6
7
编辑 (opens new window)
上次更新: 2023/11/20, 15:07:15