Kami akan menunjukkan kepada Anda di sini bagaimana Anda bisa mendapatkan tanggal mulai server MySQL/MariaDB di server CentOS. Ini dapat berguna untuk statistik server, dll.
1. Gunakan select now() – interval variable_value detik dari information_schema.global_status di mana variable_name='Uptime'; perintah pada prompt mysql.
root@web [~]# mysql
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 54690
Server version: 10.1.25-MariaDB MariaDB Server
Copyright (c) 2000, 2017, Oracle, MariaDB Corporation Ab and others.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
MariaDB [(none)]> select now() - interval variable_value second as 'MySQL started on' from information_schema.global_status where variable_name='Uptime';
+----------------------------+
| MySQL started on |
+----------------------------+
| 2017-08-12 02:14:21.000000 |
+----------------------------+
1 row in set (0.00 sec)
MariaDB [(none)]> quit
Bye
root@web [~]#
2. Gunakan mysqladmin utilitas dengan perintah mysqladmin ver|grep Uptime
root@web [~]# mysqladmin ver|grep Uptime
Uptime: 6 days 9 hours 54 min 5 sec
root@web [~]#
3. Gunakan sistem operasi layanan perintah layanan status mysqld | grep berjalan
root@web [~]# service mysqld status | grep running
Redirecting to /bin/systemctl status mysqld.service
Active: active (running) since Sat 2017-08-12 02:14:22 EDT; 6 days ago
root@web [~]#