Eric Guo's blog.cloud-mes.com

Hoping writing JS, Ruby & Rails and Go article, but fallback to DevOps note

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;

Find table name.

SELECT table_schema, table_name
FROM information_schema.tables
WHERE table_name LIKE '%contract%';

Comments