Tuesday, July 25, 2023

.::: How to Check Uptime MariaDB & Service MariaDB MySQL server was started :::.

 1. uptime 1
SHOW GLOBAL STATUS LIKE 'Uptime';
MariaDB [teguhth]> SHOW GLOBAL STATUS LIKE 'Uptime';
+---------------+-------+
| Variable_name | Value |
+---------------+-------+
| Uptime        | 165   |
+---------------+-------+
1 row in set (0.001 sec)

MariaDB [teguhth]>

 
2. uptime 2
select @@hostname,@@version, TIME_FORMAT(SEC_TO_TIME(VARIABLE_VALUE ),'%Hh %im')  as Uptime
from information_schema.GLOBAL_STATUS
where VARIABLE_NAME='Uptime';

MariaDB [teguhth]> select @@hostname,@@version, TIME_FORMAT(SEC_TO_TIME(VARIABLE_VALUE ),'%Hh %im')  as Uptime
    -> from information_schema.GLOBAL_STATUS
    -> where VARIABLE_NAME='Uptime';
+------------+-----------------+---------+
| @@hostname | @@version       | Uptime  |
+------------+-----------------+---------+
| teguhth    | 10.5.21-MariaDB | 00h 04m |
+------------+-----------------+---------+
1 row in set (0.000 sec)

MariaDB [teguhth]>


3. uptime 3
select @@hostname,@@version,now() - interval variable_value second as 'MySQL started on' from information_schema.global_status where variable_name='Uptime';

MariaDB [(none)]> select @@hostname,@@version,now() - interval variable_value second as 'MySQL started on' from information_schema.global_status where variable_name='Uptime';
+------------+-----------------+----------------------------+
| @@hostname | @@version       | MySQL started on           |
+------------+-----------------+----------------------------+
| teguhth    | 10.5.21-MariaDB | 2023-07-25 11:06:01.000000 |
+------------+-----------------+----------------------------+
1 row in set (0.001 sec)

MariaDB [(none)]>


4. uptime 4 complete
select @@hostname,@@version,now() - interval variable_value second as 'MySQL started on',TIME_FORMAT(SEC_TO_TIME(VARIABLE_VALUE ),'%Hh %im')  as Uptime from information_schema.global_status where variable_name='Uptime';

MariaDB [(none)]> select @@hostname,@@version,now() - interval variable_value second as 'MySQL started on',TIME_FORMAT(SEC_TO_TIME(VARIABLE_VALUE ),'%Hh %im')  as Uptime from information_schema.global_status where variable_name='Uptime';
+------------+-----------------+----------------------------+---------+
| @@hostname | @@version       | MySQL started on           | Uptime  |
+------------+-----------------+----------------------------+---------+
| teguhth    | 10.5.21-MariaDB | 2023-07-25 11:06:01.000000 | 00h 06m |
+------------+-----------------+----------------------------+---------+
1 row in set (0.001 sec)

MariaDB [(none)]>

 


5. uptime from OS 1
service mysqld status | grep running

[root@teguhth data]#  service mysqld status | grep running
Redirecting to /bin/systemctl status mysqld.service
   Active: active (running) since Tue 2023-07-25 11:06:01 WIB; 3min 4s ago
[root@teguhth data]#


6. uptime from mysqladmin

mysqladmin ver|grep Uptime
   
[root@teguhth data]#
[root@teguhth data]# mysqladmin ver|grep Uptime
Uptime:                 3 min 35 sec
[root@teguhth data]#

No comments:

Post a Comment

Popular Posts