<<Back to MySQL & MariaDB How To Page
Before restarting the the Instance I want to check its status
How to Check MySQL or MariaDB Instance status
There are several possible ways to check the status of MySQL or MariaDB Instance.You need to execute the below commands from bin directory of MySQL installation.
On Linux / Windows
Option 1
mysqladmin -u <username> -p Status
mysqladmin -u galera -p status
Enter password: *******
Uptime: 154500 Threads: 3 Questions: 205 Slow queries: 0 Opens: 131 Flush tables: 1 Open tables: 118 Queries per second avg: 0.001
Option 2
mysqladmin -u <username> -p ping
# mysqladmin -u galera -p ping
Enter password: *******
mysqld is alive
Option3
On Linux only
#service mysqld status
mysqld (pid 26675) is running...
On Windows only
open cmd-->type services.msc--> locate service mysql
Check the MySQL service Status
How to Stop MySQL or MariaDB Instance
to stop MySQL instance you can use service mysqld stop command. To make sure there is no application session connected to the instance before restarting it use show processlist command.mysql> show processlist;
Since there is no application session connected it is safe to stop the instance
#service mysqld stop
Stopping mysqld: [ OK ]
How to Start MySQL or MariaDB Instance
#service mysqld start
starting mysqld: [ OK ]
starting mysqld: [ OK ]
How to Find the Uptime of MySQL or MariaDB Instance
to find the up time of your MySQL or MariaDB Instance login to your MySQL/MariaDB server and execute below command. As always there are multiple ways to find it
MariaDB [(none)]> show status like 'Uptime';
+---------------+---------+
| Variable_name | Value |
+---------------+---------+
| Uptime | 1110600 |
+---------------+---------+
1 row in set (0.00 sec)
+---------------+---------+
| Variable_name | Value |
+---------------+---------+
| Uptime | 1110600 |
+---------------+---------+
1 row in set (0.00 sec)
Note:- The Uptime value displayed here is in Seconds. My MySQL instance is running since
1110600 seconds
1110600 seconds
MariaDB [(none)]> \s;
--------------
mysql Ver 15.1 Distrib 10.2.12-MariaDB, for Linux (x86_64) using readline 5.1
Connection id: 820689
Current database:
Current user: root@localhost
SSL: Not in use
Current pager: stdout
Using outfile: ''
Using delimiter: ;
Server: MariaDB
Server version: 10.2.12-MariaDB-log MariaDB Server
Protocol version: 10
Connection: Localhost via UNIX socket
Server characterset: utf8
Db characterset: utf8
Client characterset: utf8
Conn. characterset: utf8
UNIX socket: /var/lib/mysql/mysql.sock
Uptime: 12 days 20 hours 32 min 17 sec
Threads: 93 Questions: 36445319 Slow queries: 467315 Opens: 1477 Flush tables: 1 Open tables: 1024 Queries per second avg: 32.811
--------------
ERROR: No query specified
OR
Comments
Post a Comment