mysql 学习

create database dkv_db001 DEFAULT CHARACTER SET gbk COLLATE gbk_chinese_ci;

drop table `dkv_db001`.`xxx_dkv_d0003`;

 

mysqldump --opt -d databaseName -h 10.250.4.98 -uUser -pPassword > db.sql

 

查看表信息:

show table status like 'xxx_dkv_d0001'\G;

 

analyze table xxx_dkv_d0001;

 

查整个库的空间状态:

select concat(truncate(sum(data_length)/1024/1024,2),'MB') as data_size,

concat(truncate(sum(max_data_length)/1024/1024,2),'MB') as max_data_size,

concat(truncate(sum(data_free)/1024/1024,2),'MB') as data_free,

concat(truncate(sum(index_length)/1024/1024,2),'MB') as index_size

from information_schema.tables where TABLE_SCHEMA = 'dkv_db001';

 

查单表的空间状态:

select concat(truncate(sum(data_length)/1024/1024,2),'MB') as data_size,

concat(truncate(sum(max_data_length)/1024/1024,2),'MB') as max_data_size,

concat(truncate(sum(data_free)/1024/1024,2),'MB') as data_free,

concat(truncate(sum(index_length)/1024/1024,2),'MB') as index_size

from information_schema.tables where TABLE_NAME = 'xxx_dkv_d0001';

 

 

你可能感兴趣的:(sql,mysql)