首页 > 代码库 > mysql 语句集锦

mysql 语句集锦

 查看数据库各表容量大小:

select TABLE_NAME, concat(truncate(data_length/1024/1024,2),‘ MB‘) as data_size,

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

    from information_schema.tables where TABLE_SCHEMA = ‘cjss‘

    group by TABLE_NAME

    order by data_length desc;

TABLE_SCHEMA 换数据名。


每天每个媒体生采集多少变文章:

SELECT copyfrom,DATE(FROM_UNIXTIME(ext_news.publishtime)),count(*) from ext_news group by copyfrom,DATE(FROM_UNIXTIME(ext_news.publishtime))


创建用户:

grant all privileges on vtdc.* to ‘joe’@‘10.163.225.87’ identified by ‘123‘;


mysql 语句集锦