MySQLのuptimeを確認する
概要
確認方法
- MySQLの起動
dockerでMySQLを起動します。
$ docker run --name mysql-test -e MYSQL_ROOT_PASSWORD=my-secret-pw -d mysql:latest
- MySQLへ接続
$ docker exec -i -t mysql-test mysql -uroot -p
- uptimeの確認
mysql> status; -------------- mysql Ver 8.0.26 for Linux on x86_64 (MySQL Community Server - GPL) Connection id: 14 Current database: Current user: root@localhost SSL: Not in use Current pager: stdout Using outfile: '' Using delimiter: ; Server version: 8.0.26 MySQL Community Server - GPL Protocol version: 10 Connection: Localhost via UNIX socket Server characterset: utf8mb4 Db characterset: utf8mb4 Client characterset: latin1 Conn. characterset: latin1 UNIX socket: /var/run/mysqld/mysqld.sock Binary data as: Hexadecimal Uptime: 15 min 34 sec Threads: 2 Questions: 13 Slow queries: 0 Opens: 134 Flush tables: 3 Open tables: 53 Queries per second avg: 0.013 --------------
- uptimeの確認 (show status構文)
mysql> show global status like 'Uptime'; +---------------+-------+ | Variable_name | Value | +---------------+-------+ | Uptime | 1035 | +---------------+-------+ 1 row in set (0.01 sec)