Eric Guo's blog.cloud-mes.com

in HTML5, JavaScript, Ruby & Rails, Python, and Cloud MES!

My Maintain Mysql Commands

Permalink

mysql> SHOW FULL PROCESSLIST;
mysql> SELECT * FROM information_schema.innodb_trx;
mysql> kill xxx;
mysql> SHOW GRANTS FOR cad_reader;

List all table size.

SELECT
TABLE_NAME AS `Table`,
ROUND(((DATA_LENGTH + INDEX_LENGTH) / 1024 / 1024),2) AS `Size (MB)`
FROM
information_schema.TABLES
WHERE
TABLE_SCHEMA = "cybros_dev"
ORDER BY
(DATA_LENGTH + INDEX_LENGTH)
DESC;

Comments