MySQL service uptime
MySQL service uptime
Sometimes, we need to check the uptime for MySQL in our server.
There are multiple method to check the uptime status of mysql server. Let see some of them.
- mysqladmin status
[root@localhost ~]# mysqladmin -u root -p********* status
Uptime: 225921 Threads: 10 Questions: 18469911 Slow queries: 0 Opens: 12466 Flush tables: 1 Open tables: 64 Queries per second avg: 81.753
- mysqladmin ver | grep -i uptime
[root@localhost ~]# mysqladmin -u root -p********** ver | grep -i uptime
Uptime: 2 days 14 hours 48 min 13 sec
- Query to show uptime
SHOW
GLOBAL
STATUS
LIKE
'Uptime'
;
+---------------+--------+
| Variable_name | Value |
+---------------+--------+
| Uptime | 322477 |
+---------------+--------+
1 row in set (0.00 sec)
select TIME_FORMAT(SEC_TO_TIME(VARIABLE_VALUE ),’%Hh %im’) as Uptime
from information_schema.GLOBAL_STATUS
where VARIABLE_NAME=’Uptime’;