Check Startup time and Uptime of MySQL

Check the Startup time and Uptime of MySQL

Check the last startup time of MySQL

SELECT DATE_SUB(now(), INTERVAL variable_value SECOND) "LAST STARTUP" from performance_schema.global_status where variable_name='Uptime';

+----------------------------+
| LAST STARTUP               |
+----------------------------+
| 2019-06-13 12:39:31.000000 |
+----------------------------+
1 row in set (0.00 sec)

Check the uptime of MySQL

mysql> select TIME_FORMAT(SEC_TO_TIME(VARIABLE_VALUE ),'%Hh %im') as Uptime from
performance_schema.global_status where VARIABLE_NAME='Uptime';

+---------+
| Uptime  |
+---------+
| 43h 46m |
+---------+
1 row in set (0.00 sec)

Uptime in Seconds
Note: The uptime is in seconds.

mysql> SHOW GLOBAL STATUS LIKE 'Uptime';

+---------------+--------+
| Variable_name | Value  |
+---------------+--------+
| Uptime        | 157840 |
+---------------+--------+
1 row in set (0.00 sec)

Check more detail about MySQL including uptime, character-set, port number

mysql> \s

--------------
C:\Program Files\MySQL\MySQL Server 8.0\bin\mysql.exe  Ver 8.0.16 for Win64 on x
86_64 (MySQL Community Server - GPL)

Connection id:          36
Current database:
Current user:           root@localhost
SSL:                    Cipher in use is DHE-RSA-AES128-GCM-SHA256
Using delimiter:        ;
Server version:         8.0.16 MySQL Community Server - GPL
Protocol version:       10
Connection:             localhost via TCP/IP
Server characterset:    utf8mb4
Db     characterset:    utf8mb4
Client characterset:    cp850
Conn.  characterset:    cp850
TCP port:               3306
Uptime:                 1 day 19 hours 45 min 4 sec

Threads: 4  Questions: 1449  Slow queries: 0  Opens: 348  Flush tables: 3  Open
tables: 249  Queries per second avg: 0.009
--------------

Check the uptime from Workbench
Login with Workbench and go to adminstrator tab –> Server Status –> Running since will show uptime and start time

Running Status

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.