MySQL實用功能

1.MySQL查詢各個表的數據量

use information_schema;
select table_name,table_rows from tables
where TABLE_SCHEMA = ‘數據庫名字’
order by table_rows desc;

2.查看內存緩存使用情況

SHOW GLOBAL STATUS LIKE ‘innodb_buffer_pool_pages_%’;

3.MySQL數據庫優化建議

  1. 數據庫最大連接調到1000
  2. innodb_buffer_pool_size=4G
  3. innodb_flush_log_at_trx_commit=0
  4. innodb_log_file_size=1000M

4.MySQL複製表操作

create table bi_core_order201811 as select * from 表名 where 查詢條件

5.MySQL查看連接使用情況

show status like ‘Threads%’;
show global status like ‘Max_used_connections’;
show variables like ‘%max_connections%’;

5.MySQL事件開啓狀態

show variables like ‘event_scheduler’;

6.顯示當前SQL進程

show processlist

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章