# mysql -uroot -p
# mysqladmin -uroot -p version
select @@version;
show databases;
show processlist
# cat /etc/my.cnf
>show engines;
默认的引擎
show variables like '%storage_engine%';
show variables like 'log_%';
# cat /etc/my.cnf |grep log
log-bin=mysql-bin
binlog_format=mixed
log-error=/var/log/mysqld.log
# tail -n 20 /var/log/mysqld.log
select concat(round(sum(DATA_LENGTH/1024/1024)+sum(INDEX_LENGTH/1024/1024), 2), 'MB') as data from information_schema.tables
所有库大小
select TABLE_SCHEMA, concat(truncate(sum(data_length)/1024/1024,2),' MB') as data_size,concat(truncate(sum(index_length)/1024/1024,2),'MB') as index_size from information_schema.tables group by TABLE_SCHEMA order by data_length desc;
指定库所有表大小
select TABLE_NAME, concat(truncate(data_length/1024,2),' KB') as data_size, concat(truncate(index_length/1024,2),' KB') as index_size from information_schema.tables where TABLE_SCHEMA = 'mysql' group by TABLE_NAME order by data_length desc;
show status like 'table%';
如果waited数值较高,说明锁争用较严重
show status like 'key_read%';
key_reads/key_read_requests 尽可能低,至少是1:100,最好是1:1000
show status like 'Qcache%';
Qcache_lowmem_prunes值非常大,说明缓冲不够
Qcache_hits非常大,说明查询缓冲使用非常频繁,需增大缓冲
show global status like 'Slave_running';
show status like '%tmp%';
正常created_tmp_disk_tables/created_tmp_tables*100%<=25%
免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。