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

7.显示开启MySQL查询慢日志功能

set global slow_query_log = on; 
set global log_output = file;
set long_query_time = 1;
show variables like '%quer%';
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章