# mysql -uroot -p
成都創(chuàng)新互聯(lián)公司堅(jiān)信:善待客戶,將會(huì)成為終身客戶。我們能堅(jiān)持多年,是因?yàn)槲覀円恢笨芍档眯刨嚒N覀儚牟缓鲇瞥踉L客戶,我們用心做好本職工作,不忘初心,方得始終。10余年網(wǎng)站建設(shè)經(jīng)驗(yàn)成都創(chuàng)新互聯(lián)公司是成都老牌網(wǎng)站營(yíng)銷服務(wù)商,為您提供成都網(wǎng)站設(shè)計(jì)、做網(wǎng)站、成都外貿(mào)網(wǎng)站建設(shè)公司、網(wǎng)站設(shè)計(jì)、H5場(chǎng)景定制、網(wǎng)站制作、品牌網(wǎng)站建設(shè)、小程序設(shè)計(jì)服務(wù),給眾多知名企業(yè)提供過(guò)好品質(zhì)的建站服務(wù)。
# mysqladmin -uroot -p version
select @@version;
show databases;
show processlist
# cat /etc/my.cnf
>show engines;
默認(rèn)的引擎
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
所有庫(kù)大小
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_sizefrom information_schema.tables group by TABLE_SCHEMAorder by data_lengthdesc;
指定庫(kù)所有表大小
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數(shù)值較高,說(shuō)明鎖爭(zhēng)用較嚴(yán)重
show status like 'key_read%';
key_reads/key_read_requests 盡可能低,至少是1:100,最好是1:1000
show status like 'Qcache%';
Qcache_lowmem_prunes值非常大,說(shuō)明緩沖不夠
Qcache_hits非常大,說(shuō)明查詢緩沖使用非常頻繁,需增大緩沖
show global status like 'Slave_running';
show status like '%tmp%';
正常created_tmp_disk_tables/created_tmp_tables*100%<=25%