Dec 17, 2021

MySQL Uptime

 MySQL Uptime 


SELECT

  VARIABLE_VALUE AS Uptime_seconds,

  NOW() AS "Now",

  NOW() - INTERVAL VARIABLE_VALUE SECOND AS "Up since",

  DATEDIFF(NOW(), NOW() - INTERVAL VARIABLE_VALUE SECOND) AS "Uptime_days"

FROM performance_schema.session_status

WHERE VARIABLE_NAME = 'Uptime';


Output Example:

+----------------+---------------------+----------------------------+-------------+

| Uptime_seconds | Now                 | Up since                   | Uptime_days |

+----------------+---------------------+----------------------------+-------------+

| 16430228       | 2021-04-09 14:11:58 | 2020-10-01 10:14:50.000000 |         190 |

+----------------+---------------------+----------------------------+-------------+


No comments:

Post a Comment

If you have any doubt or question, please contact us.