In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly introduces how to check the uptime of the MySQL/MariaDB database on Linux, which has a certain reference value, and interested friends can refer to it. I hope you can learn a lot after reading this article.
Method 1: how to use the ps command to check the uptime of the MySQL/MariaDB database on Linux
The rocess-monitoring/ "class=" ext "rel=" external nofollow "target=" _ blank "> ps command means the process status process status. This is one of the most basic commands that show the details of the processes that the system is running.
To do this, you first need to use the rocess-id-pid-ppid-linux/ "class=" ext "rel=" external nofollow "target=" _ blank "> pidof command to find the PID of MySQL/MariaDB.
# pidof mysqld | cut-d ""-F1 2412
After getting the PID of MySQL/MariaDB, use the-- etime option in the ps command to get uptime.
-- etime: the elapsed time since the process was started, in the form of [[DD-] hh:] mm:ss.
# ps-p 2412-o etime ELAPSED2-08:49:30
Alternatively, use the-- lstart option in the ps command to get the uptime of the specified PID.
# ps-p 2412-o lstart STARTEDSat May 2 03:02:15 2020
The MySQL/MariaDB process has been running for 2 days, 03 hours, 02 minutes, 15 seconds.
Method 2: how to use the systemctl command to check the uptime of the MySQL/MariaDB database on Linux
The systemctl command is used to control the systemd system and service manager.
Systemd is the new initialization system and system manager, and now most Linux distributions have eliminated the traditional SysVinit manager and adopted systemd.
# systemctl status mariadb or # systemctl status mysql ● mariadb.service-MariaDB 10.1.44 database server Loaded: loaded (/ usr/lib/systemd/system/mariadb.service; enabled; vendor preset: disabled) Drop-In: / etc/systemd/system/mariadb.service.d └─ migrated-from-my.cnf-settings.conf Active: active (running) since Sat 2020-05-02 03:02:18 UTC 2 days ago Docs: man:mysqld (8) https://mariadb.com/kb/en/library/systemd/ Process: 2448 ExecStartPost=/bin/sh-c systemctl unset-environment _ WSREP_START_POSITION (code=exited, status=0/SUCCESS) Process: 2388 ExecStartPre=/bin/sh-c [!-e / usr/bin/galera_recovery] & & VAR= | | VAR=/usr/bin/galera_recovery [$?-eq 0] & & systemctl set-environment _ WSREP_START_POSITION=$VAR | | exit 1 (code=exited, status=0/SUCCESS) Process: 2386 ExecStartPre=/bin/sh-c systemctl unset-environment _ WSREP_START_POSITION (code=exited, status=0/SUCCESS) Main PID: 2412 (mysqld) Status: "Taking your SQL requests now …" CGroup: / system.slice/mariadb.service └─ 2412 / usr/sbin/mysqld May 03 21:41:26 ns2.2daygeek.com mysqld [2412]: 2020-05-03 21:41:26 140328136861440 [Warning] Host name '1.1.1.1' could not be resolved: … Not knownMay 04 02:00:46 ns2.2daygeek.com mysqld [2412]: 2020-05-04 2:00:46 140328436418304 [Warning] IP address' 1.1.1.1' has been resolved to the host name'2... ss itself.May 04 03:01:31 ns2.2daygeek.com mysqld [2412]: 2020-05-04 3:01:31 140328436111104 [Warning] IP address' 1.1.1.1' could not be resolved: Temporary fai … ResolutionMay 04 04:03:06 ns2.2daygeek.com mysqld [2412]: 2020-05-04 4:03:06 140328136861440 [Warning] IP address' 1.1.1.1 'could not be resolved: Name or ser … Not knownMay 04 07:23:54 ns2.2daygeek.com mysqld [2412]: 2020-05-04 7:23:54 140328435189504 [Warning] IP address' 1.1.1.1' could not be resolved: Name or service not knownMay 04 08:03:31 ns2.2daygeek.com mysqld [2412]: 2020-05-04 8:03:31 140328436418304 [Warning] IP address' 1.1.1.1' could not be resolved: Name or service not knownMay 04 08:25:56 ns2.2daygeek.com mysqld [2412]: 2020-05-04 8:25:56 140328135325440 [Warning] IP address' 1.1.1.1 'could not be resolved: Name or service not knownWarning: Journal has been rotated since unit was started. Log output is incomplete or unavailable.Hint: Some lines were ellipsized, use-l to show in full. Method 3: how to use the MySQLAdmin command to check the uptime of the MySQL/MariaDB database on Linux
MySQLAdmin is the MySQL server command line program that is installed when you install the MySQL software package.
The MySQLAdmin client allows you to perform some basic administrative functions on the MySQL server.
It is used to create databases, delete databases, set root passwords, change root passwords, check MySQL status, verify MySQL functionality, monitor mysql processes, and verify server configuration.
# mysqladmin-u root-pPassword version mysqladmin Ver 8.42 Distrib 5.7.27, for Linux on x86_64Copyright (c) 2000, 2019, Oracle and/or its affiliates. All rights reserved. Oracle is a registered trademark of Oracle Corporation and/or itsaffiliates. Other names may be trademarks of their respectiveowners. Server version 5.7.27Protocol version 10Connection Localhost via UNIX socketUNIX socket / var/lib/mysql/mysql.sockUptime: 1 day 10 hours 44 min 13 sec Thank you for reading this article carefully. I hope the article "how to check the uptime of MySQL/MariaDB database on Linux" shared by the editor will be helpful to you. At the same time, I hope you will support us and pay attention to the industry information channel. More related knowledge is waiting for you to learn!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.