How to quickly query mysql

Mysql quick query method: 1. Query the running transaction; 2. View the current connection, and know the number of connections; 3. View the size of a table; 4. View all tables of a database size. More related free learning recommendation: mysql tutorial (video) mysql quick query Method: 1. Query running transactions select p.id,p.user,p .host,p.db,p.command,p.time,i.trx_state,i.trx_started,p.info from information_schema.processlist p,information_schema.innodb_trx i where p.id=i.trx_mysql_thread_id; 2. Check the current connection and be able to know the number of connections select SUBSTRING_INDEX(host,’:’,1) as ip , count(*) from information_schema.processlist group by ip; 3. Check the size of a table select concat(round(sum(DATA_LENGTH/1024/ 1024), 2), ‘M’) from information_schema.tables where table_schema=’database name’ AND table_name=’table name’; 4. Check the size of all tables in a database select table_name,concat(round(sum(DATA_LENGTH/1024/1024),2),’M’) from information_schema.tables where table_schema=’t1′ group by table_name ; 5. Check the size of the library and the size of the remaining space select table_schema, round((sum(data_length / 1024 / 1024 ) + sum(index_length / 1024 / 1024)), 2) dbsize, round(sum(DATA_FREE / 1024 / 1024), 2) freesize, round((sum(data_length / 1024 / 1024) + sum(index_length / 1024 / 1024) + sum(DATA_FREE / 1024 / 1024)), 2) spsize from information_schema.tables where table_schema not in (‘mysql’, ‘information_schema’, ‘performance_schema’) group by table_schema order by freesize desc; 6. Find about…

Contact Us

Contact us

181-3619-1160

Online consultation: QQ交谈

E-mail: [email protected]

Working hours: Monday to Friday, 9:00-17:30, holidays off

Follow wechat
Scan wechat and follow us

Scan wechat and follow us

Follow Weibo
Back to top
首页
微信
电话
搜索