-- Program: my2html.80.sh
-- Info: MySQL (8.0) DBA Database SQL report in HTML
-- Date: 2018-04-19
-- Version: 1.0.17 (2020-01-14)
-- Author: Bartolomeo Bogliolo mail@meo.bogliolo.name
-- License: GPL
--
-- Notes:
-- Init: 1-APR-2006 meo@bogliolo.name
-- Initial version
-- 1.0.14: 19-APR-2018
-- Production 8.0 script version based on 1.0.13c MySQL 5.7 script
-- 1.0.15: 14-FEB-2019
-- Latests versions update
-- 1.0.16: 22-JUL-2019
-- Latests versions update
-- 1.0.17: 01-JAN-2020
-- Lastest versions update
--
-- Usage: mysql --user=$USR --password=$PSS --host=$HST --port=$PRT --force --skip-column-names < my2html.80.sql > $HSTN.$PRT.htm 2> /dev/null
USR=root
# Careful with security, Eugene!!
PSS=
HST=127.0.0.1
HSTN=`hostname`
PRT=3306
use information_schema;
select '
Statistics generated on: ', now();
select ' by: ', user(), 'as: ',current_user();
select 'using: my2html.80.sh v.1.0.17 (2020-01-01)';
select '
Software by ';
select 'Meo
Summary |
';
select 'Item', ' | Value';
select ' |
Version :', ' | ', version()
union
select ' |
Created :', ' | ', min(create_time)
from tables
union
select ' |
Started :', ' | ', date_format(date_sub(now(), INTERVAL variable_value second),'%Y-%m-%d %T')
from performance_schema.global_status
where variable_name='UPTIME'
union
select ' |
DB Size (MB):',
' | ',
format(sum(data_length+index_length)/(1024*1024),0)
from tables
union
select ' |
Buffers Size (MB):',
' | ',
format(sum(variable_value+0)/(1024*1024),0)
from performance_schema.global_variables
where lower(variable_name) like '%buffer_size' or lower(variable_name) like '%buffer_pool_size'
union
select ' |
Logging Bin. :', ' | ', variable_value
from performance_schema.global_status
where variable_name='LOG_BIN'
union
select ' |
Defined Users :',
' | ', format(count(*),0)
from mysql.user
union
select ' |
Defined Schemata :',
' | ', count(*)
from schemata
where schema_name not in ('information_schema')
union
select ' |
Defined Tables :',
' | ', format(count(*),0)
from tables
union
select ' |
Sessions :', ' | ', format(count(*),0)
from processlist
union
select ' |
Sessions (active) :', ' | ', format(count(*),0)
from processlist
where command <> 'Sleep'
union
select ' |
Questions (#/sec.) :',
' | ', format(g1.variable_value/g2.variable_value,5)
from performance_schema.global_status g1, performance_schema.global_status g2
where g1.variable_name='QUESTIONS'
and g2.variable_name='UPTIME'
union
select ' |
BinLog Writes Day (MB) :',
' | ', format((g1.variable_value*60*60*24)/(g2.variable_value*1024*1024),0)
from performance_schema.global_status g1, performance_schema.global_status g2
where g1.variable_name='INNODB_OS_LOG_WRITTEN'
and g2.variable_name='UPTIME'
union
select ' |
Hostname :', ' | ', variable_value
from performance_schema.global_variables
where variable_name ='hostname'
union
select ' |
Port :', ' | ', variable_value
from performance_schema.global_variables
where variable_name ='port';
select ' |
Version check |
' ;
select 'Version',
' | Supported',
' | Last releases (N or N-1)',
' | Last updates (N or N-1)',
' | Last update (N) ',
' | Notes';
select ' |
', version();
select ' | ', if(SUBSTRING_INDEX(version(),'.',2) in ('8.0','5.7','5.6', '10.4','10.3','10.2','10.1'), 'YES', 'NO') ; -- supported version
select ' | ', if(SUBSTRING_INDEX(version(),'.',2) in ('8.0','5.7', '10.4','10.3'), 'YES', 'NO') ; -- last2 releases
select ' | ', if(SUBSTRING_INDEX(version(),'-',1)
in ('8.0.17','5.7.27','5.6.44', '10.1.41','10.2.26','10.3.17','10.4.7','5.5.65',
'8.0.18','5.7.28','5.6.45', '10.1.42','10.2.27','10.3.18','10.4.8','5.5.66',
'8.0.19','5.7.29','5.6.46', '10.1.43','10.2.28','10.3.19','10.4.9','5.5.67'), 'YES', 'NO') ; -- last2 updates (and the next)
select ' | ', if(SUBSTRING_INDEX(version(),'-',1)
in ('8.0.18','5.7.28','5.6.45', '10.1.42','10.2.27','10.3.18','10.4.8','5.5.66',
'8.0.19','5.7.29','5.6.46', '10.1.43','10.2.28','10.3.19','10.4.9','5.5.67'), 'YES', 'NO') ; -- last updates (and the next)
select ' | Last Releases: 8.0.18, 5.7.28, 5.6.46' from dual; -- notes
select ' Last Releases (MariaDB): 10.4.11, 10.3.21, 10.2.30, 10.1.43, 5.5.65' from dual;
select ' |
Schema/Object Matrix |
' ;
select 'Database',
' | Tables',
' | Indexes',
' | Routines',
' | Triggers',
' | Views',
' | Primary Keys',
' | Foreign Keys',
' | All' ;
select ' |
', sk,
' | ', sum(if(otype='T',1,0)),
' | ', sum(if(otype='I',1,0)),
' | ', sum(if(otype='R',1,0)),
' | ', sum(if(otype='E',1,0)),
' | ', sum(if(otype='V',1,0)),
' | ', sum(if(otype='P',1,0)),
' | ', sum(if(otype='F',1,0)),
' | ', count(*)
from ( select 'T' otype, table_schema sk, table_name name
from tables
union
select 'I' otype, constraint_schema sk, concat(table_name,'.',constraint_name) name
from key_column_usage
where ordinal_position=1
union
select 'R' otype, routine_schema sk, routine_name name
from routines
union
select 'E' otype, trigger_schema sk, trigger_name name
from triggers
union
select 'V' otype, table_schema sk, table_name name
from views
union
select distinct 'P' otype, CONSTRAINT_SCHEMA sk, TABLE_NAME name
from KEY_COLUMN_USAGE
where CONSTRAINT_NAME='PRIMARY'
union
select distinct 'F' otype, CONSTRAINT_SCHEMA sk, concat(TABLE_NAME,'-',CONSTRAINT_NAME) name
from KEY_COLUMN_USAGE
where REFERENCED_TABLE_NAME is not null
) a
group by sk with rollup;
select ' |
Space Usage |
' ;
select 'Database',
' | Row#',
' | Data size',
' | Index size',
' | Total size',
' | ',
' | MyISAM',
' | InnoDB',
' | Memory',
' | Other Engines',
' | Created';
select ' |
', table_schema,
' | ', format(sum(table_rows),0),
' | ', format(sum(data_length),0),
' | ', format(sum(index_length),0),
' | ', format(sum(data_length+index_length),0),
' | ',
' | ', format(sum((data_length+index_length)*
if(engine='MyISAM',1,0)),0),
' | ', format(sum((data_length+index_length)*
if(engine='InnoDB',1,0)),0),
' | ', format(sum((data_length+index_length)*
if(engine='Memory',1,0)),0),
' | ', format(sum((data_length+index_length)*
if(engine='Memory',0,if(engine='MyISAM',0,if(engine='InnoDB',0,1)))),0),
' | ', date_format(min(create_time),'%Y-%m-%d')
from tables
group by table_schema with rollup;
select ' |
Users |
' ;
select 'User',
' | Host',
' | SL IUD CDGRIA CCS CAE RR SSPFSR ',
' | Select',
' | Execute',
' | Grant',
' | Empty Password',
' | Expired',
' | Password lifetime',
' | Locked';
SELECT ' |
',user,
' | ', host,
' | ', CONCAT(Select_priv, Lock_tables_priv,' ',
Insert_priv, Update_priv, Delete_priv, ' ', Create_priv, Drop_priv,
Grant_priv, References_priv, Index_priv, Alter_priv, ' ',
Create_tmp_table_priv, Create_view_priv, Show_view_priv, ' ',
Create_routine_priv, Alter_routine_priv, Execute_priv, ' ',
Repl_slave_priv, Repl_client_priv, ' ',
Super_priv, Shutdown_priv, Process_priv, File_priv, Show_db_priv, Reload_priv) AS grt,
' | ', select_priv,
' | ', execute_priv,
' | ', grant_priv,
' | ', if(authentication_string<>'','','NO PWD'),
' | ', password_expired,
' | ', password_lifetime,
' | ', account_locked
FROM mysql.user d
order by user,host;
select ' |
';
select '
DB Access |
' ;
select 'User',
' | Host',
' | DB',
' | Select',
' | Execute',
' | Grant';
SELECT ' |
',user,
' | ', host,
' | ', db,
' | ', select_priv,
' | ', execute_priv,
' | ', grant_priv
FROM mysql.db d
order by user,host;
select ' |
Virtual Roles |
' ;
select 'Access Level | Users' ;
select ' |
Admin | ' ;
select concat(user,'@',host) User
from mysql.user
where insert_priv='Y' or delete_priv='Y'
order by 1;
select ' |
Oper | ' ;
select concat(user,'@',host)
from mysql.user
where select_priv='Y'
and concat(user,'@',host) not in (
select concat(user,'@',host)
from mysql.user
where insert_priv='Y' or delete_priv='Y')
order by 1;
select ' |
Schema Owner | ' ;
select concat(user,'@',host)
from mysql.db
where create_priv='Y';
select ' |
CRUD | ' ;
select concat(user,'@',host)
from mysql.db
where insert_priv='Y'
and concat(user,'@',host) not in (
select concat(user,'@',host)
from mysql.db
where create_priv='Y')
order by 1;
select ' |
Read Only | ' ;
select concat(user,'@',host)
from mysql.db
where select_priv='Y'
and concat(user,'@',host) not in (
select concat(user,'@',host)
from mysql.db
where insert_priv='Y')
order by 1;
select ' |
Other | ' ;
select concat(user,'@',host)
from mysql.user
where concat(user,'@',host) not in (
select concat(user,'@',host)
from mysql.db
where select_priv='Y')
and concat(user,'@',host) not in (
select concat(user,'@',host)
from mysql.user
where select_priv='Y')
order by 1;
select ' |
Users with poor passwords |
' ;
select 'User',
' | Host',
' | Password',
' | Note';
SELECT ' |
',user,
' | ', host,
' | ',
' | Empty password'
FROM mysql.user
WHERE authentication_string = '';
SELECT ' |
',host,
' | ', user,
' | ', authentication_string,
' | Same as username'
FROM mysql.user
WHERE authentication_string = UPPER(CONCAT('*', CAST(SHA1(UNHEX(SHA1(user))) AS CHAR)))
OR authentication_string = UPPER(CONCAT('*', CAST(SHA2(UNHEX(SHA2(user,256)),256) AS CHAR)));
-- Known hash: root, secret, password, mypass, public, private, 1234, admin, secure, pass, mysql, my123, ...
SELECT ' |
',host,
' | ', user,
' | ', authentication_string,
' | Weak password'
FROM mysql.user
WHERE authentication_string in ('*81F5E21E35407D884A6CD4A731AEBFB6AF209E1B', '*14E65567ABDB5135D0CFD9A70B3032C179A49EE7',
'*2470C0C06DEE42FD1618BB99005ADCA2EC9D1E19', '*6C8989366EAF75BB670AD8EA7A7FC1176A95CEF4',
'*A80082C9E4BB16D9C8E41B0D7EED46126DF4A46E', '*85BB02300F877EB061967510E83F68B1A7325252',
'*A4B6157319038724E3560894F7F932C8886EBFCF', '*4ACFE3202A5FF5CF467898FC58AAB1D615029441',
'*A36BA850A6E748679226B01E159EF1A7BF946195', '*196BDEDE2AE4F84CA44C47D54D78478C7E2BD7B7',
'*E74858DB86EBA20BC33D0AECAE8A8108C56B17FA', '*AF35041D44DF3E88C9F97CC8D3ACAF4695E65B69',
UPPER(CONCAT('*', CAST(SHA1(UNHEX(SHA1('prova'))) AS CHAR))),
UPPER(CONCAT('*', CAST(SHA1(UNHEX(SHA1('test'))) AS CHAR))),
UPPER(CONCAT('*', CAST(SHA1(UNHEX(SHA1('demo'))) AS CHAR))),
UPPER(CONCAT('*', CAST(SHA1(UNHEX(SHA1('qwerty'))) AS CHAR))),
UPPER(CONCAT('*', CAST(SHA1(UNHEX(SHA1('manager'))) AS CHAR))),
UPPER(CONCAT('*', CAST(SHA1(UNHEX(SHA1('supervisor'))) AS CHAR))),
UPPER(CONCAT('*', CAST(SHA1(UNHEX(SHA1('toor'))) AS CHAR))),
UPPER(CONCAT('*', CAST(SHA1(UNHEX(SHA1('Qwerty'))) AS CHAR))),
UPPER(CONCAT('*', CAST(SHA1(UNHEX(SHA1('xxx'))) AS CHAR))),
UPPER(CONCAT('*', CAST(SHA1(UNHEX(SHA1('moodle'))) AS CHAR))),
UPPER(CONCAT('*', CAST(SHA1(UNHEX(SHA1('drupal'))) AS CHAR))),
UPPER(CONCAT('*', CAST(SHA1(UNHEX(SHA1('admin01'))) AS CHAR))),
UPPER(CONCAT('*', CAST(SHA1(UNHEX(SHA1('joomla'))) AS CHAR))),
UPPER(CONCAT('*', CAST(SHA1(UNHEX(SHA1('wp'))) AS CHAR))),
UPPER(CONCAT('*', CAST(SHA1(UNHEX(SHA1('ilikerandompasswords'))) AS CHAR))),
UPPER(CONCAT('*', CAST(SHA1(UNHEX(SHA1('changeme'))) AS CHAR))) );
SELECT ' |
',host,
' | ', user,
' | ', authentication_string,
' | Old [pre 4.1] password format'
FROM mysql.user
WHERE authentication_string not like '*%'
AND authentication_string not like '$%'
AND authentication_string <> '';
SELECT ' |
',host,
' | ', user,
' | ', authentication_string,
' | Suspected backdoor user'
FROM mysql.user
WHERE user in ('hanako', 'kisadminnew1', '401hk$', 'guest', 'Huazhongdiguo110');
select ' |
Tuning Parameters (most used ones) |
';
select 'Parameter',
' | Value | Type' ;
select ' |
', variable_name, ' | ', variable_value, ' | Cache'
from performance_schema.global_variables
where lower(variable_name) in ('query_cache_type')
union
select ' |
', variable_name, ' | ', variable_value, ' | Tuning and timeout'
from performance_schema.global_variables
where lower(variable_name) in (
'log_bin',
'slow_query_log')
union
select ' |
', variable_name, ' | ', format(variable_value,0), ' | Cache'
from performance_schema.global_variables
where lower(variable_name) in (
'innodb_buffer_pool_size',
'query_cache_size',
'innodb_additional_mem_pool_size',
'innodb_log_file_size',
'innodb_log_buffer_size',
'key_buffer_size',
'table_open_cache',
'tmp_table_size',
'max_heap_table_size',
'foo')
union
select ' |
', variable_name, ' | ', format(variable_value,0), ' | Tuning and timeout'
from performance_schema.global_variables
where lower(variable_name) in (
'innodb_flush_log_at_trx_commit',
'innodb_flush_log_at_timeout',
'innodb_log_files_in_group',
'innodb_lock_wait_timeout',
'innodb_thread_concurrency',
'skip-external-locking',
'wait_timeout',
'long_query_time',
'sync_binlog',
'foo')
union
select ' |
', variable_name, ' | ', format(variable_value,0), ' | Client Cache'
from performance_schema.global_variables
where lower(variable_name) in (
'binlog_cache_size',
'binlog_stmt_cache_size',
'max_connections',
'read_buffer_size',
'read_rnd_buffer_size',
'sort_buffer_size',
'join_buffer_size',
'thread_stack',
'foo')
order by 5, variable_name;
select ' |
Performance Statistics Summary |
' ;
select 'Statistic | Value | Suggested value | Potential Action';
select ' |
', variable_name, ' (days) | ', round(variable_value/(3600*24),1), '', ''
from performance_schema.global_status
where variable_name='UPTIME'
union
select ' |
', 'Buffer Cache: MyISAM Read Hit Ratio',
' | ', format(100-t1.variable_value*100/t2.variable_value,2), ' | >95', ' | Increase KEY_BUFFER_SIZE'
from performance_schema.global_status t1, performance_schema.global_status t2
where t1.variable_name='KEY_READS' and t2.variable_name='KEY_READ_REQUESTS'
union
select ' |
', 'Buffer Cache: InnoDB Read Hit Ratio',
' | ', format(100-t1.variable_value*100/t2.variable_value,2), ' | >95', ' | Increase INNODB_BUFFER_SIZE'
from performance_schema.global_status t1, performance_schema.global_status t2
where t1.variable_name='INNODB_BUFFER_POOL_READS' and t2.variable_name='INNODB_BUFFER_POOL_READ_REQUESTS'
union
select ' |
', 'Buffer Cache: MyISAM Write Hit Ratio',
' | ', format(100-t1.variable_value*100/t2.variable_value,2), ' | >95', ' | Increase KEY_BUFFER_SIZE'
from performance_schema.global_status t1, performance_schema.global_status t2
where t1.variable_name='KEY_WRITES' and t2.variable_name='KEY_WRITE_REQUESTS'
union
select ' |
', 'Log Cache: InnoDB Log Write Ratio',
' | ', format(100-t1.variable_value*100/t2.variable_value,2), ' | >95', ' | Increase INNODB_LOG_BUFFER_SIZE'
from performance_schema.global_status t1, performance_schema.global_status t2
where t1.variable_name='INNODB_LOG_WRITES' and t2.variable_name='INNODB_LOG_WRITE_REQUESTS'
union
select ' |
', 'Query Cache: Efficiency (Hit/Select)',
' | ', format(t1.variable_value*100/(t1.variable_value+t2.count_star),2), ' | >30', ' | '
from performance_schema.global_status t1, performance_schema.events_statements_summary_global_by_event_name t2
where t1.variable_name='QCACHE_HITS'
and t2.event_name='statement/sql/select'
union
select ' |
', 'Query Cache: Hit ratio (Hit/Query Insert)',
' | ', format(t1.variable_value*100/(t1.variable_value+t2.variable_value),2), ' | >80', ' | '
from performance_schema.global_status t1, performance_schema.global_status t2
where t1.variable_name='QCACHE_HITS'
and t2.variable_name='QCACHE_INSERTS'
union
select ' |
', s.variable_name, ' | ', concat(s.variable_value, ' /', v.variable_value),
' | Far from maximum', ' | Increase MAX_CONNECTIONS'
from performance_schema.global_status s, performance_schema.global_variables v
where s.variable_name='THREADS_CONNECTED'
and v.variable_name='MAX_CONNECTIONS'
union
select ' |
', variable_name, ' | ', variable_value, ' | LOW', ' | Check user load'
from performance_schema.global_status
where variable_name='THREADS_RUNNING'
union
select ' |
', variable_name, ' | ', format(variable_value,0), ' | LOW', ' | Check application'
from performance_schema.global_status
where variable_name='SLOW_QUERIES'
union
select ' |
', g1.variable_name, ' #/sec. | ', format(g1.variable_value/g2.variable_value,5), '', ''
from performance_schema.global_status g1, performance_schema.global_status g2
where g1.variable_name='QUESTIONS'
and g2.variable_name='UPTIME'
union
select ' |
', 'SELECT', ' #/sec. | ', format(g1.count_star/g2.variable_value,5), '', ''
from performance_schema.events_statements_summary_global_by_event_name g1, performance_schema.global_status g2
where g1.EVENT_NAME = 'statement/sql/select'
and g2.variable_name='UPTIME'
union
select ' |
', 'COMMIT', ' #/sec. (TPS) | ', format(g1.count_star/g2.variable_value,5), '', ''
from performance_schema.events_statements_summary_global_by_event_name g1, performance_schema.global_status g2
where g1.EVENT_NAME = 'statement/sql/commit'
and g2.variable_name='UPTIME'
union
select ' |
', g1.variable_name, ' #/sec. | ', format(g1.variable_value/g2.variable_value,5), '', ''
from performance_schema.global_status g1, performance_schema.global_status g2
where g1.variable_name='CONNECTIONS'
and g2.variable_name='UPTIME'
union
select ' |
','COM DML #/sec.',' | ',
format((g2.count_star+g3.count_star+g4.count_star+g5.count_star+g6.count_star
+g7.count_star+g8.count_star+g9.count_star)/g1.variable_value,5),
'', ''
from performance_schema.global_status g1, performance_schema.events_statements_summary_global_by_event_name g2,
performance_schema.events_statements_summary_global_by_event_name g3, performance_schema.events_statements_summary_global_by_event_name g4,
performance_schema.events_statements_summary_global_by_event_name g5, performance_schema.events_statements_summary_global_by_event_name g6,
performance_schema.events_statements_summary_global_by_event_name g7, performance_schema.events_statements_summary_global_by_event_name g8,
performance_schema.events_statements_summary_global_by_event_name g9
where g1.variable_name='UPTIME'
and g2.event_name='statement/sql/insert'
and g3.event_name ='statement/sql/update'
and g4.event_name ='statement/sql/delete'
and g5.event_name ='statement/sql/select'
and g6.event_name ='statement/sql/update_multi'
and g7.event_name ='statement/sql/delete_multi'
and g8.event_name ='statement/sql/replace'
and g9.event_name ='statement/sql/replace_select'
union
select ' |
', g1.variable_name, ' Mb/sec. | ',
format(g1.variable_value*8/(g2.variable_value*1024*1024),5), '', ''
from performance_schema.global_status g1, performance_schema.global_status g2
where g1.variable_name='BYTES_SENT'
and g2.variable_name='UPTIME'
union
select ' |
', g1.variable_name, ' Mb/sec. | ',
format(g1.variable_value*8/(g2.variable_value*1024*1024),5), '', ''
from performance_schema.global_status g1, performance_schema.global_status g2
where g1.variable_name='BYTES_RECEIVED'
and g2.variable_name='UPTIME'
union
select ' |
', 'DBcpu (SUM_TIMER_WAIT)', ' | ',
format((sum(SUM_TIMER_WAIT)/1000000000000)/variable_value, 5), '', ''
from performance_schema.global_status, performance_schema.events_statements_summary_global_by_event_name
where variable_name='UPTIME'
group by variable_value
order by 1;
select ' |
Performance Advice |
' ;
select 'Expert suggestions on | Value | | Action to correct';
select ' |
', g1.variable_name, ' #/hour | ',
format((g1.variable_value*60*60)/g2.variable_value,5), ' | ', ' | Increase TABLE_OPEN_CACHE'
from performance_schema.global_status g1, performance_schema.global_status g2
where g1.variable_name='OPENED_TABLES'
and g2.variable_name='UPTIME'
and g1.variable_value*60*60/g2.variable_value>12
union
select ' |
', g1.variable_name, ' #/hour | ',
format((g1.variable_value*60*60)/g2.variable_value,5), ' | ', ' | Increase SORT_BUFFER_SIZE'
from performance_schema.global_status g1, performance_schema.global_status g2
where g1.variable_name='SORT_MERGE_PASSES'
and g2.variable_name='UPTIME'
and g1.variable_value*60*60/g2.variable_value>12
union
select ' |
', g1.variable_name, ' % | ',
format(g1.variable_value*100/(g1.variable_value+g2.variable_value),5), ' | ', ' | Increase MAX_HEAP_TABLE_SIZE and TMP_TABLE_SIZE'
from performance_schema.global_status g1, performance_schema.global_status g2
where g1.variable_name='CREATED_TMP_DISK_TABLES'
and g2.variable_name='CREATED_TMP_TABLES'
and g1.variable_value/g2.variable_value>0.1
union
select ' |
', g1.variable_name, ' % | ',
format(g1.variable_value*100/(g2.variable_value),5), ' | ', ' | Increase BINLOG_CACHE_SIZE'
from performance_schema.global_status g1, performance_schema.global_status g2
where g1.variable_name='BINLOG_CACHE_DISK_USE'
and g2.variable_name='BINLOG_CACHE_USE'
and g1.variable_value/g2.variable_value>0.2
union
select ' |
', g1.variable_name, ' #/hour | ',
format((g1.variable_value*60*60)/g2.variable_value,5), ' | ', ' | Increase INNODB_LOG_BUFFER_SIZE'
from performance_schema.global_status g1, performance_schema.global_status g2
where g1.variable_name='INNODB_LOG_WAITS'
and g2.variable_name='UPTIME'
and g1.variable_value*60*60/g2.variable_value>1
union
select ' |
', g1.variable_name, ' MB/hour | ',
format((g1.variable_value*60*60)/(g2.variable_value*1024*1024),5), ' | ', ' | Tune INNODB_LOG_FILE_SIZE'
from performance_schema.global_status g1, performance_schema.global_status g2
where g1.variable_name='INNODB_OS_LOG_WRITTEN'
and g2.variable_name='UPTIME'
and (g1.variable_value*60*60)/(g2.variable_value*1024*1024)>5
order by 1;
select ' |