首页  编辑  

查看MySQL运行时间和启动时间

Tags: /MySQL/   Date Created:
查看MySQL运行时间和启动时间

-- 查看 MySQL 运行时长
SELECT CONCAT(variable_value DIV 86400, "天", CAST(variable_value % 86400 / 3600 AS DECIMAL(10, 2)), "小时") FROM information_schema.global_status WHERE variable_name='Uptime';

-- 查看MySQL启动时间
SELECT NOW() - INTERVAL variable_value SECOND FROM information_schema.global_status WHERE variable_name='Uptime';